0

All,

I'm attempting to use command substitution to keep command line arguments in a file. My initial thought was to simply place the command line arguments in a single line in a file and then call my command as command $( cat [arguments-file] ) other arguments However, this does not seem to be working for me correctly.

I started to do some debugging, turning on bash debug via set -x and the result of the command is

command $( /tmp/arg-file ) File.xml
+ command -m '"Manhattan' Item 'MockService"' -P 'Hellp=Value' File.xml

My argument file's contents are

-m "Manhattan Item MockService" -P Hellp=Value

Is anyone able to explain why the single quotes are being added during the command substitution?

mklauber
  • 133
  • 1
  • 6
  • BashFAQ/050 [I'm trying to put a command in a variable, but the complex cases always fail!](http://mywiki.wooledge.org/BashFAQ/050) – glenn jackman Jun 25 '13 at 18:05

1 Answers1

1

They're not. The single quotes are only visible via set -x in order to disambiguate the words to the reader. However, storing command arguments like this is problematic at best. Consider storing one argument per line and using read and an array to generate the command line.

Ignacio Vazquez-Abrams
  • 45,939
  • 6
  • 79
  • 84