Hi,
I'm trying to get a shell script to work on every file in a directory. But I have a problem with spaces in the filenames. Here's a code example to illustrate:
Code:
#!/bin/sh
for f in $(ls -1)
do
echo :"$f"
done
And here's what happens:
Code:
$ ls -1
aa
te st
zz
$ ../dirtest
:aa
:te
:st
:zz
As you can see, the file entries get split by their space. Any ideas on how to conquer this problem?
- script-newbie