Bash and Single Quotes

Joachim Backes joachim.backes at rhrk.uni-kl.de
Sun Jan 11 13:26:17 UTC 2009


Cameron Simpson wrote:
> On 10Jan2009 22:34, RGH <rgheck at comcast.net> wrote:
>> I'm trying to write a shell script to convert video files using vlc and  
>> avidemux, and I've run into a problem. I need to be able to do something  
>> like this:
>>
>>    vlc -v -I dummy $FIL  
>> --sout='#transcode{vcodec=dummy,acodec=mp3,ab=192}:std{access=file,mux=dummy,dst="$MP3"}' 

an alternative:

--sout='#transcode{vcodec=dummy,acodec=mp3,ab=192}:std{access=file,mux=dummy,dst='"$MP3"'}'

Joachim Backes <joachim.backes at rhrk.uni-kl.de>

>> vlc://quit
>>
>> But of course this doesn't work because the $MP3 variable doesn't get  
>> expanded in single quotes. The single quotes seem to need to be there to  
>> protect the "{", though. So, how can this be done?
> 
> No, they don't. They're there to protect the double quotes, presuming
> you literally need double quotes in the --sout= option value.
> 
> You want to use double quotes.
> If you want literal double quotes, escape them, eg:
> 
>   --sout="#transcode...,dst=\"$MP3\"}"
> 
> (replace ... with the other stuff I left out)
> 
> Cheers,


-- 

Joachim Backes <joachim.backes at rhrk.uni-kl.de>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6101 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20090111/aef09623/attachment-0001.bin>


More information about the fedora-list mailing list