Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Thanks for the great tip, its worked great!
now i'm trying to fix an end of file problem. I've programmed this file to delete all zero length files and i keep getting an end of file error
#!/bin/bashif [$1 == -f]
then
find $2 -empty -print -exec rm -f {}\
else
find $1 -empty -ok rm -f {}\
fi
i've tried adding "done" "exit" and "exit 0"
there is definetly something I'm missing here!Littlemissknit

Don't forget the "point-comma" (excuse-me, I'm french, don't know the real name) : ";"
I think some spaces are also missing.
I think this should be:
if [$1 == -f]
then
find $2 -empty -print -exec rm -f {} \;
else
find $1 -empty -ok rm -f {} \;
fiRegards
Xavier

i entered what you said and it said that for the "if [$1 == -f]" that i'm missing a ']' but i closed the line like you did in the file.
it also says i'm missing an argument to "-ok'

Try adding quotes. Ex:
if [ "$1" = "-f" ]
All of the Bash shell scripts I've written required the arguments to be quoted. Also in Bash, I think you can use a single equals sign for evaluation. See the following for some examples:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-6.html#ss6.3
Good luck!
Rob Pectol
http://rob.pectol.com/

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |