Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable in an IF statement

Status
Not open for further replies.

chris01010

Programmer
Jan 29, 2004
25
GB
Afternoon all,

Trying to run an IF statement within a script in KSH. Basically I want it to check whether a variable has a value set or whether it is blank.

I currently have the below, but needless to say it's not working. Can anyone spot where i'm going wrong?

If [ $FILE != '' ]

then .......

Any help gratefully appreciated.

Thanks

Chris
 
Take a look at -z in the man test page.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for the post.

I checked that earlier, but I missed the -n option.

Thanks again

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top