Shell pipes and in-place insanity(fakedrake.github.io) |
Shell pipes and in-place insanity(fakedrake.github.io) |
Also, see `sponge` from `moreutils` (http://kitenet.net/~joey/code/moreutils/):
$ man sponge
...
sponge reads standard input and writes it out to the specified file.
Un‐like a shell redirect, sponge soaks up all its input before opening the output file.
This allows constructing pipelines that read from and write to the same file. [0] https://www.gnu.org/software/bash/manual/bashref.html#Pipelines
[1] https://www.gnu.org/software/bash/manual/bashref.html#ListsThe shell sets up the pipe and file redirections for each process in the pipeline, then lets them go. It has no control over when the child processes read or write. It could be a race condition, but it's written in such a way that it appears that the file will get truncated before it can be read virtually 100% of the time.
echo "1\n2\n3\n4\n" > numbers && cat numbers | { sleep 1 && cat > numbers && cat numbers ; }
That's not exactly the same (because the redirection for cat #2 now happens in a subshell), but it shows that this is basically racy. :)
Monospace fonts, black on white, at default sizes, are your best bets.
Please make these sorts of choices again in the future!
The code examples are all but unreadable.
http://i.imgur.com/ogS9yat.png
Here's a quick improvement for legibility. I'm not claiming a thing of beauty.
http://i.imgur.com/mW880fB.png
My general style guidelines are included here:
[1] http://rvfblog.wordpress.com/2011/03/07/using-naquadah-theme...
Perhaps your color vision is now at the point where you should consider loading an accessibility stylesheet into your browser. I don't look forward to the day when I am required to do this, but I do know that it will inevitably arrive.
It seems that some of the stylesheets are broken for HTTPS. Note that this is not https-everywhere breaking the site; simply switch the URL to https://, and you will see what I see.
1188 stylesheets and counting.