annoying BASH does not interpret quotation marks right?

Filippos Klironomos presariod at gmail.com
Sun May 7 23:47:36 UTC 2006


Thanks! That did it (no backlashes)!!!

Filippos


On 5/7/06, Robert Nichols <rnicholsNOSPAM at comcast.net> wrote:
>
> Filippos Klironomos wrote:
> > Hello list,
> >
> > I'm trying to parse a list of videos I have to convert them to a
> > different format. The video names
> > have spaces in them so I do something like:
> >
> > for file in *.flv ; do ffmpeg -i \"${file}\" \"${file}.avi\" ; done
> >
> > but the quotmarks do not work and ffmpeg is not fed the whole video name
> > but only the
> > part up to the first space so it fails. On the contrary if I just echo
> > the whole command like:
> >
> > for file in *.flv ; do echo ffmpeg -i \"${file}\" \"${file}.avi\" ; done
> >
> > I get exactly what I expect which is the ffmpeg command with the full
> > file names enclosed in
> > quotemarks. if I just highlight that output and paste it back on the
> > command prompt it runs like
> > a charm.
>
> In both cases bash is doing exactly what it should, and that is NOT
> passing a quote-enclosed file name as you think it is.  If you have
> a file named
>
>            Some file name.fli
>
> that is getting passed as three separate arguments:
>
>        '"Some'    'file'    'name.avi"'
>
> where I have inserted single quote marks to delimit the arguments.
> The echo command will, of course, display that as:
>
>         "Some file name.avi"
>
> which looks like what you want, but isn't.
>
> Just leave out the backslashes in your command.  That will let the
> shell pass each file name as a single argument with embedded white
> space, and ffmpeg should be happy with that.  If, for some reason,
> you really wanted to pass the file name with enclosing quote marks,
> you would have to do it this way:
>
> for file in *.flv ; do echo "\"${file}\"" "\"${file}.avi\"" ; done
>
> --
> Bob Nichols         Yes, "NOSPAM" is really part of my email address.
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20060507/15a97c48/attachment-0002.html 


More information about the users mailing list