Saturday 15 June 2013

bash - Pipe data into shell command expecting a filename -



bash - Pipe data into shell command expecting a filename -

suppose have shell command foo expects file such bar.txt argument, , want pass one-line file foo , erase so:

echo "this 1 line file" > bar.txt foo bar.txt rm bar.txt

is there way in single line of shell script without ever creating file bar.txt?

you can utilize process substitution:

foo <(echo "this 1 line file")

bash shell

No comments:

Post a Comment