Reputation
1,536
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
1 9 19
Impact
~105k people reached

Feb
1
asked Tar waiting a long time at end of block device
Jan
22
comment Arrays in Unix Bourne Shell
It may be worth noting that positional parameters differ from bash arrays in some key features. For example, they do not support sparse arrays, and since sh doesn't have slicing parameter expansion, you can't access sublists like "${@:2:4}". To be sure, I see the similarities, but I don't regard positional parameters as an array per se.
Jan
22
asked Defeat rabbitmq-server dpkg autostart
Jan
14
comment Shell Arithmetic Expansion with Quotes
@EtanReisner you mean like x='"123"';echo $(($x))? That gives an error, too.
Jan
13
asked Shell Arithmetic Expansion with Quotes
Jan
13
awarded  Notable Question
Jan
12
revised Run same command with different parameters
added 236 characters in body
Jan
12
answered Run same command with different parameters
Jan
10
comment Difference between /dev/null and /dev/zero
Also see thecodelesscode.com/case/6
Jan
4
comment How to insert a string in array with different manner
I'm confused why you refer back to the previous element instead of just building up the split range on str. It's not wrong, but it seems convoluted to me.
Jan
4
comment Copy All Files With Certain Length File Name
In bash, you could also use the nullglob shell option to avoid testing if any such file exists.
Dec
17
comment sudo (cd /some/dir; ./runscript.sh) fails
Of course, using the parentheses inside the sh -c is kinda pointless, as it gives you a subshell inside a sub process for no apparent reason.
Dec
8
awarded  Nice Question
Nov
23
awarded  Good Answer
Jul
24
comment How can I make a script to count up by fives?
This isn't an OS difference per se. It's a version difference. OS X only has BASH 3 OOTB. You can install a BASH from this century using almost any OS X package manager. I use Home Brew, for one.
Jul
12
comment Not able to cat a string from a file under a string of another file
ed "$file" <<< w will write trailing new lines to a file lacking one.
Jun
12
awarded  Famous Question
Jun
11
comment How can I put a bit mask on /dev/zero so that I can get bytes other than zero?
@Peter.O I'm not sure how you interpreted my comment to mean anything other than the literal, static expression yes 1 | tr -d $'\n'. I suppose you could use a shell that doesn't do the $'' backslash treatment, or you could try to find a locale that alters tr -d $'\n', but I haven't found it yet.
Jun
10
comment How can I put a bit mask on /dev/zero so that I can get bytes other than zero?
Or use yes 1 | tr -d $'\n' for that matter.
Jun
8
comment Issue an error when using empty shell variables
If PROJECT_HOME is set, but the name is not a directory, then [[ -d $PROJECT_HOME ]] && rm -r "$PROJECT_HOME" will do nothing, silently. But [[ -z $PROJECT_HOME ]] || rm -r "$PROJECT_HOME" will silently delete "$PROJECT_HOME", even if it's a file that is not a directory. Getting an error message is never a problem: if [[ -d $PROJECT_HOME ]]; then rm -r "$PROJECT_HOME"; else printf '%s is not a directory\n' "$PROJECT_HOME" >&2; fi