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:

  1. "param
  2. 1"
  3. param2
  4. param3

but like:

  1. param 1
  2. param2
  3. 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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -