Is there a way to pass arguments via pipe on bash?
The following works in Ubuntu:
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.
Alternatively:
echo value1 value2|( read p1 p2; echo mkdir -p ./$p1/$p2 )
This will work with all bash
implementations, but it will need elaboration if either value contains any blanks.
(I have used echo mkdir
to show the effect.)
How about
echo v1 v2 | awk '{print "./"$1"/"$2}' | xargs mkdir -p