bash - command line argument from file content with quote -
i have file containing command line arguments pass script.
but file contain element such "param 1" param2 param3
.
let's call file arguments test.tmp
, script file script.sh
.
if do:
script.sh -p `cat test.tmp` -other_params 1 2 3
the script.sh
receives after p
:
"param
1"
param2
param3
but like:
param 1
param2
param3
any idea?
small precision: assume script.sh
not modifiable. solution must take place in shell.
assumption: test.tmp
needs contain parameter per line approach.
you may use xargs linefeed delimiter:
cat test.tmp | xargs -d '\n' script.sh -p
Comments
Post a Comment