Reputation
3,074
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
6 18
Newest
 Nice Answer
Impact
~64k people reached

Apr
24
revised Is there a standard abbreviation for 'find . -name foo' or do I need a function for this?
added 2 characters in body
Mar
24
comment Running commands on several files and giving each output a unique name
What does the if explain? You're introducing a conditional with no actual condition. Its only purpose is to group commands in order to share a file for standard output, and that's exactly what braces are for.
Mar
24
comment Running commands on several files and giving each output a unique name
Just use { ... } in place of the if statement.
Mar
23
comment Shell variable $_ not behaving as expected
@J.Chomel I'm not sure what you think is a bug, even jokingly.
Mar
16
comment What is the token identifier of `]`?
It's just a string, and [ raises an error if its final argument isn't exactly equal to ].
Mar
15
answered What differences are between the shell attributes/options that are set/unset by `set -o` and by `set` with another option?
Mar
15
comment Pass options / parameters - arguments to bash script
I think of otherwise unnecessary assignments like parm="$1" as documentation, although using a more descriptive name is a good idea in that case.
Feb
24
comment How does `man git init` get the right man page?
The important thing is that this is unique to a specific implementation of man. It is by no means universal or particular common.
Jan
29
comment What happens when a non-root user sends signals to root user's process?
Other than SIGKILL, which is a special case and managed completely by the kernel, signals are merely a request. The receiving process can do anything they want with them.
Jan
29
comment Why do here-documents attempt shell substitution even on a commented line?
A # does not introduce a comment in a here document for the same reason it does not introduce a comment in "# $(echo foo)": a string is data, not code.
Jan
28
answered How to define alias for non interactive/non login shell?
Jan
27
comment How does the -d option to bash read work?
It's also worth nothing that read -d '' is a bit of a hack. You aren't specifying any character to look for as the end of a line (or possibly you are looking for the null character, ASCII 0, which due to implementation details cannot occur in a string), so read always just reads up to the end of its input, at which point it exits with a non-zero exit status because it never found the requested end-of-line character. This can be an issue if you are expecting read to succeed, such as if you are using set -e.
Jan
22
comment evaluation of arithmetic expansion in bash
Definitely worth a bug report to bug-bash@gnu.org; it's not fixed in 4.4, currently under development.
Jan
22
comment evaluation of arithmetic expansion in bash
/bin/echo preserves the difference, so it seems like output redirections for external commands happen in a subshell.
Jan
21
comment Recursive Function not Working
It's not ridiculous, but bash 4 introduced the ** pattern to avoid the need to write an explicit recursive function: for INDEX in **/*; do.
Jan
21
comment Why is subshell created by background control operator (&) not displayed under pstree
@HaukeLaging "But what process should that be if there is no external command to run?" A fork always creates a copy of the current process; there's no such thing as a process without a command. The shell starts any external command by forking, and the new copy of the shell then executes exec to replace itself with the new command.
Jan
21
revised What's wrong with this for loop in bash script?
Remove obsolete (and unnecessary) form of arithmetic expression
Jan
21
comment What's wrong with this for loop in bash script?
Note this will only work for integer-valued parameters.
Jan
20
comment Why is subshell created by background control operator (&) not displayed under pstree
& always causes the shell to fork. The forked shell process either handles the command itself (which is the case with exit), or makes a system call to (some form of) exec to replace itself with the given command.
Jan
18
comment In `dmesg | head`, (how) is dmesg being killed after 10 lines of output?
Technically, head terminates after it outputs 10 lines; it may consume more than 10 lines of input before doing so.