Shell script help
Discussion
Help me I'm a numpty:
find -iname *.bmp | xargs -l1 convert_file
Where convert_file is a script to do some conversion and general faffing about (to 000's of files in 00's of subdirs). Problem is if a file has got a space in it, convert_file ends up seeing the first half of the filename as $1, the second bit as $2 etc. etc. and throws away the spaces. Whats the best way around this? or am I going about this all the wrong way?
Cheers
Neil
find -iname *.bmp | xargs -l1 convert_file
Where convert_file is a script to do some conversion and general faffing about (to 000's of files in 00's of subdirs). Problem is if a file has got a space in it, convert_file ends up seeing the first half of the filename as $1, the second bit as $2 etc. etc. and throws away the spaces. Whats the best way around this? or am I going about this all the wrong way?
Cheers
Neil
Sorry, away from a un*x box right now, but would be tempted to do something like:
find -iname *.bmp >>/usr/tmp/fer.$$
while true
do
read $FILE || break
converfile $FILE
done </usr/tmp/fer.$$
find -iname *.bmp >>/usr/tmp/fer.$$
while true
do
read $FILE || break
converfile $FILE
done </usr/tmp/fer.$$
I am a little rusty, so all this could be b**locks, but PM me and I will have a bash tomorrow when I get into work
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff




