273 reputation
28
bio website
location Seattle, WA
age 30
visits member for 3 years, 1 month
seen 2 hours ago

2h
awarded  Scholar
2h
accepted How do I use null bytes in Bash?
13h
revised How do I use null bytes in Bash?
rephrased a bit more honestly
Dec
13
awarded  Self-Learner
Dec
13
comment Is space not allowed in a filename?
@terdon: Since you never posted the question, I've taken the liberty of posting a self-answered one: unix.stackexchange.com/q/174016/12378. Please let me know if you have any feedback on it.
Dec
13
awarded  Student
Dec
13
asked How do I use null bytes in Bash?
Dec
13
answered How do I use null bytes in Bash?
Oct
26
comment Dash equivalent of self-redirection of script output
@mikeserv: Re: "it works in any shell": Not true. I tried your original example in Bash, Dash, and Zsh, and it worked only in Dash. (N.B. This was on Cygwin, which is what I had handiest. I can check more typical environments, namely Ubuntu and RHEL5, if desired.) Also, echo ... | tee -a /dev/fd/0 didn't work in any of the three (tee: /dev/fd/0: Permission denied), but that doesn't surprise me; I'm guessing you really meant echo ... | tee -a /dev/fd/1, which worked in all of them.
Oct
26
comment Dash equivalent of self-redirection of script output
@mikeserv: Not just heredocs, but also /dev/fd/3 (in that precise form), and the details of what happens to whitespace . . . and for that matter, the fact that this whole approach works at all in Dash, when it doesn't work in other shells that have all of the components, means that the overall approach is a special rule to remember. (This reminds me of attempts to create a simplified English with less vocabulary; they cut out words like persist, but they ignore just-as-difficult idioms like keep on.)
Oct
25
comment Dash equivalent of self-redirection of script output
@mikeserv: It involves plenty of rules to remember; perhaps you have simply grown so used to them that you don't notice.
Oct
25
comment Dash equivalent of self-redirection of script output
@mikeserv: In what sense is cat /dev/fd/3 3<<HEREDOC\n$(get output)\nHEREDOC\n "easier" than cat <(get output)?
Aug
4
comment Is space not allowed in a filename?
@terdon: That's not really true. $'\0' is equivalent to '' -- and (for example) $'foo\0bar' is equivalent to foo. You may prefer to write $'\0' instead of '' when the notation better matches the semantics you have in mind, but don't let it deceive you.
Jun
16
awarded  Caucus
Jun
16
awarded  Constituent
Oct
26
comment Pipe to multiple files in the shell
+1. This is the most generally-applicable answer, since it doesn't depend on the fact that the specific filtering command was grep.
Oct
22
comment Why does while [ 0 ] go into infinite loop?
Re: "When it isn't given an expression that looks like a comparison, file test, or one of the other operations it can do, it simply succeeds": I don't think that's a good way to put it. After all, [ ] (with no argument) and [ "" ] (with a single empty argument) do not succeed.
Oct
7
comment How to display the number of lines output by a command in real time?
+1, though to be absolutely correct, you should change read to read -r (since otherwise a backslash at the end of a line would mess with the counting). Incidentally, with a bit of work, this can be adapted to also show the latest line of output, which may be useful for some commands.
Sep
22
comment What is the name of the shell feature `>(tee copyError.txt >&2)`?
The first half of this answer is wrong, or at least highly misleading; it's true that > can denote output-redirection and that () can denote a subshell, but >(...) is actually a single, unitary feature that does not consist of > and ().
Sep
19
comment What exactly is an environment variable?
Some of this is not quite right. For example, subshells are subprocesses and must be fork()ed, but they do receive (copies of) shell variables.