[wellylug] BASH scripting help required
andrej at paradise.net.nz
andrej at paradise.net.nz
Fri May 7 13:55:10 NZST 2004
Quoting "E.Chalaron" <e.chalaron at xtra.co.nz>:
> /home/edouard/this\ dir/file\ test.txt
> Can you rename the all lot such as
> /home/edouard/thisdir/filetest.txt
strip_blk.sh
#!/bin/bash
newname=`echo $1 | sed "s/ /_/g"`
you'll have to do something about the individual
item, though, I'd suggest running it with
a loop and getting deeper and deeper
levels of directories...
for i=1 to 7 (?)
do
find --max-depth=$i -iname "* *" -exec strip_blk.sh {} \;
done
Cheers,
Tink
More information about the wellylug
mailing list