[PD-ot] using "-send" and shell-variables

Hans-Christoph Steiner hans at eds.org
Mon Mar 13 23:15:46 CET 2006


IOhannes m zmoelnig wrote:
> IOhannes m zmoelnig wrote:
> 
>>hi
>>
>>any bash-gurus out there?
>>
>>i want to make a little script like
>>
>><script>
>> #!/bin/sh
>> OPTIONS='-send "pd quit"'
>> pd ${OPTIONS}
>></script>
>>
>>unfortunately the shell-expansions seems to screw up my mind, and thus i
> 
> 
> a workaround for my problem seems to be to give the send-message
> explicitely and in quotes. like:
> <script>
>  #!/bin/sh
>  OPTIONS="-rt -open ${PATCH}"
>  MSG="pd quit"
>  pd ${OPTIONS} -send "${MSG}"
> </scrip>
> 
> leaving the MSG empty doesn't do anything (which is good).
> 
> however, i would like a cleaner solution (where the entire
> options-string is built dynamically)

Both above scripts work for me, I think the problem lies elsewhere.  '' 
quotes mean literal, so no expansion of variables is done.  Quotes 
inside of quotes are just characters, only the outer most count (AFAIK).

VAR=test

echo '$VAR'    prints: $VAR
echo "$VAR"    prints: test
echo '"$VAR"'  prints: "$VAR"
echo "'$VAR'"  prints: 'test'

If that helps at all.  You might want to try sticking with only " and 
escaping the ones inside:

echo "\"$VAR\""  prints: "test"

.hc




More information about the PD-ot mailing list