howto write a script to echo files with spaces in the name
I wrote a simple script to ls files in the directory
and echo them on the screen. The condition being
1 if $x is a directory: echo $x is a directory, or echo it is a file...
I have a couple of directorys in my home folder with spaces in their
names because of which I got the following error.
Please advise on how to correct this problem..
ls -1 | while read file
if [ -d $file ]
echo "$file is Directory"
echo "$file is a file"
./loop.sh: line 5: [: Testing: binary operator expected
Testing Books is a file
thunderbird is Directory