OT: bash help

Steve Searle steve at stevesearle.com
Sun Jul 7 19:03:02 UTC 2013


Around 07:29pm on Sunday, July 07, 2013 (UK time), Mike Wright scrawled:

> I'm trying to write a bash command to transcode some videos into audios 
> but am having trouble with filenames that contain spaces.
> 
> ls *flv
> 
> returns this:
> 
> Jorge Drexler - Al otro Lado del Río.flv
> 
> But in a bash for loop it doesn't work.
> 
> for f in `ls *flv`; do echo $f; done
> 
> returns this:
> 
> Jorge
> Drexler
> -
> Al
> otro
> Lado
> del
> Río.flv
> 
> Anybody know how to keep $f intact?

Look at the use of the IFS internal variable in bash and do something
like:

IFS=$(echo -en "\n\b"); for f in `ls *flv`; do echo $f; done

Steve


-- 
 
 Play Champions - my free football predictions game at:
 	http://www.stevesearle.com/champs/about.html

 20:00:34 up 44 days, 23:20,  1 user,  load average: 0.01, 0.02, 0.00
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20130707/e9222cce/attachment.sig>


More information about the users mailing list