The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



Thread: Case Statement
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-31-2004
zazzybob's Avatar
zazzybob zazzybob is offline
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Two things. You write
Code:
 if [! -e "$item"];
echo The File does not exit
exit
fi
This has two errors and should read
Code:
if [ ! -f "$item" ]; then
   echo "$item does not exist"
   exit
fi
Amend to that and see if that fixes it.

You've also got spaces in your variable assignment, and no $ infront of the file variable name to reference it. You are, in effect, setting the value of item to "file". Another "no, no!"
Do this
Code:
item=$file
as you can see, no spaces either side of the equals.

Elaborate more on the script. What does it do? What is it for? And give the "proper" output from the script.

Cheers
ZB
http://www.zazzybob.com
Reply With Quote