Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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