.bash_subshell - GiselleSerate/myaliases GitHub Wiki
Functions that perform subshell related tricks.
The prepend
command is a portable way to prepend text to a file without creating a temporary file (unlike GNU sed -i
). This is usually faster because it allows one to bypass unnecessary file IO operations. Text can be specified either from stdin or as arguments to the command. In addition, prepend
is flexible enough to work with almost any type of file, including named pipes. Note, however, that prepend
is not recommended for large files.
prepend <file> <text>
cmd | prepend <file>