Computing.Net > Forums > Unix > Wild Card in the if statment

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Wild Card in the if statment

Reply to Message Icon

Name: Junes
Date: November 16, 2006 at 08:58:04 Pacific
OS: Unix
CPU/Ram: NA
Product: NA
Comment:

How can i change the if statement in the script, so i can have a wild card for emacrofnp*, rather than writing the following

if [[ $POLICY != "emacrofnp01" || $POLICY != "emacrofnp02" || $POLICY != "emacrofnp03" || $POLICY != "emacrofnp04"]] ...etc

if [$POLICY != "emacrofnp*"]


King Regards

Junes



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: November 16, 2006 at 13:20:56 Pacific
Reply:

How about using a case statement:

case "$POLICY" in
emacrofnp*) echo "it begins with macrofnp";;
*) echo "it does not" ;;
esac


0
Reply to Message Icon

Related Posts

See More


sort problem awk 3 files together



Post Locked

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


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Wild Card in the if statment

Wild Cards in Windows www.computing.net/answers/unix/wild-cards-in-windows/1615.html

if word exit in the file www.computing.net/answers/unix/if-word-exit-in-the-file/8041.html

is there a wild card for pattern? www.computing.net/answers/unix/is-there-a-wild-card-for-pattern/8290.html