[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash variable escaping



On Wed, 11 Sep 2013 11:37:55 +0200
Vincent Zweije <vincent@zweije.nl> wrote:

> All these will pass the single quotes to salt which is wrong. #3 also
> misses the closing double quote.

My mistake, when I put it together in the mail.

> ||  machines='*'
> ||  salt $machines
> ||  salt ${machines}
> ||  salt "${machines}
> ||  salt "$machines"
> ||  not working
 
> #4 should work. The value of the machine variable does not have the
> single quotes. It turns out that without double quotes, the shell
> first expands the variable, then expands the filename pattern (which
> is a single asterisk). The double quotes prevent filename expansion.

Thanks a lot. If I don't give the single quotes in the dialog and use
#4 everything works fine. set -x output is then: 

/usr/bin/salt '*' state.highstate -b 10

Best regards
Denis Witt


Reply to: