New answers tagged

0

I've written a script just for that. Here's the link to it on Github. Here is an example usage: Let's add a pev variable first: $ pev add longpath '/A/very/very/long/path/I/frequently/need' # output: # environment variable "pev_longpath" added successfully. "pev show" to see the list of pev variables. Now let's see a list of pev variables defined so far: ...


0

Well I have used this in the past, but tried to trim down my configs while setting Postfix up this time around. I'm not sure why Ubuntu doesn't need it, but Fedora does, but this is how I fixed it. /etc/postfix/main.cf: canonical_maps = hash:/etc/postfix/canonical /etc/postfix/canonical: root user@gmail.com Reload Postfix and test! --> postmap /etc/...


3

If you want variables, you shouldn’t use alias: MYID='elijah' DEVHOME='/opt/data/users' MYHOME="${DEVHOME}/${MYID}" with double quotes instead of single quotes so that the variables are expanded. Once these are set, you can see their values using echo or any similar command: echo "$MYHOME" If you want their values to be available to other programs ...


5

unalias -a according to the man page.


2

One way with GNU find or compatible (-iname is already a GNU extension anyway) could be to define the function as: findn() ( if [ -t 1 ]; then # if the output goes to a terminal action=-print # simple print for the user to see else action=-print0 # NUL-delimited records so the output can be post-processed fi first=true for arg do if "$...


4

Your solution works just fine with xargs: $ echo "foo bar one" > foobarone $ echo "foo bar two" > fooBARtwo $ findn "bar" ./fooBARtwo ./foobarone $ findn "bar" | xargs cat foo bar two foo bar one Or is there anything I have missed? And if you modify your function a little bit, you could add additional parameters to your find command: findn () { ...


0

One thing that is missing from several answers is that this is shell-dependent. If you're using the system default shell on 10.14 on below, which is bash, then references to (.)bash_profile are correct. Modifying /etc/profile would create the alias for sh for all users (but not in bash). If you have switched, for example, to zsh, then making a system-wide ...


0

Just adding to answer from @edward-torvalds, In your .aliases file, the use of a Tab might not be visible enough for some. Your alias definition can be written as such for better reading: alias sudo=$'nocorrect sudo\t' However, I did have issues with a trailing space, but not a trailing tab. alias sudo='sudo ' alias sudo='nocorrect sudo ' above aliases ...


0

I can think of a few options but I don't think you'll be able to achieve exactly what your looking for. If you added into your /etc/hosts to include 192.168.122.1 jenkins.world nexus.world Then in your browser you could go to jenkins.world:8080 or nexus.world:8081 , noting that you would have to include/switch the port number as it cannot be placed in ...


0

That's probably because your system uses Cloud-init (https://cloudinit.readthedocs.io/en/latest/). To regain control over your hosts file, you have to edit /etc/cloud/cloud.cfg and change manage_etc_hosts from 'true' to 'false'.


3

Put setopt auto_cd in your .zshrc and just type ../. But if you really want to make c work as a near-cd that strips off a leading d from the first argument, you can make it a function: function c { cd "${1#d}" "${@[2,#]}" } With some more work you could even make it do completion after the d. But I don't see the point. Just omit cd altogether.


Top 50 recent answers are included