[clug] Spaces in filenames?

Steven Farlie steven.farlie at anu.edu.au
Wed Aug 20 10:15:44 EST 2003


On Tue, 2003-08-19 at 22:13, Paul Warren wrote:
> I've got a whole bunch of .wav files with spaces in them.  Now it seems
> that linux command line tools don' like spaces.   My usual script to
> encode as ogg's doesn't work:
<snip!>
> My question is, How do I turn the spaces to underscores, or
> alternatively, make a script that can work with spaces in filenames!

Just to add another way to do it, in bash there is a variable called IFS
which by default is IFS=$' \t\n', which means spaces tabs and newlines.
You can change IFS to tabs and newlines in your script:

#!/bin/sh
IFS=$'\t\n'

for x in `ls *.wav`
do
  oggenc -q6 "$x"
done

-- 
Steven Farlie




More information about the linux mailing list