Is there any way to pass arguments via pipe on bash?
echo value1 value2 | mkdir -p ./$1/$2
The line above would create the directories ./value1/value2
If this is not possible I would accept suggestions.
Any help is appreciated.
The following works in Unbuntu:
echo -e value1\\nvalue2|echo mkdir -p ./`line`/`line`
I can't guarantee that all
bash implementations will read the lines in left-to-right order.
echo value1 value2|( read p1 p2; echo mkdir -p ./$p1/$p2 )
This will work with all
bash implementations, but will need elaboration if either value contains blanks.
(I have used
echo mkdir to show the effect.)