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?

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.