![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question about Setting Flags | chris1234 | UNIX for Dummies Questions & Answers | 2 | 04-11-2008 09:43 AM |
| Processes Communication Only with flags! | vaggelakis | UNIX for Advanced & Expert Users | 1 | 01-05-2008 10:23 AM |
| Making flags for my script | rcunn87 | Shell Programming and Scripting | 6 | 06-29-2006 07:23 AM |
| question concerning Grep flags | jalge2 | AIX | 2 | 06-22-2005 06:18 AM |
| What does bad elf flags mean? | penguin-friend | UNIX for Advanced & Expert Users | 1 | 01-16-2002 07:27 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi folks.
I'm just starting to teach myself shell scripting and am having some trouble with an if statement. I am working with a directory where only one file will reside at a time and need to evaluate if this file is compressed to determine subsequent steps. I'm using echo for testing purposes. The syntax is: if [ * -f != "*.Z"] then echo "not zipped" else echo "zipped" fi my problem is with the -f flag. I do not want the script to use . or .. , only an ordinary file. When I use -f, I get the correct echo for the .Z file currently in this directory, but I get the error "-f: unknown test operator". If I remove the -f, the echo is incorrect. Whatever can I do? Thanks, kristy |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
ok, I've investigated further and it doesn't look like I'm on the right track with this.
|
|
#3
|
||||
|
||||
|
-f is a shell operator, as I recall, to test if a file exists. The way you are using the -f operator is not how -f was designed to be used, it seems.
|
||||
| Google The UNIX and Linux Forums |