Computing.Net > Forums > Unix > unix if statement

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.

unix if statement

Reply to Message Icon

Name: Mayil
Date: April 24, 2008 at 04:29:31 Pacific
OS: Unix
CPU/Ram: NA
Product: NA
Comment:

hi,

need to know how to use if statement at high level with explnation and example

Yasodha



Sponsored Link
Ads by Google

Response Number 1
Name: lankrypt0
Date: April 24, 2008 at 06:13:21 Pacific
Reply:

The if statement is exactly what you would think. It test one value against another, then performs actions based on that test. For example, in the following script:
#!/usr/bin/ksh
x=1
if [[ $x -gt 0 ]];then
print "X is greater than 0"
else
print "X is not greater than 0"
fi

The result of that script would be "X is greater than 0" because we tested the value of x and determined it to be greater than (-gt) the value of 0.

That is the if statement at a very high level.


0
Reply to Message Icon

Related Posts

See More







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: unix if statement

If statement in unix www.computing.net/answers/unix/if-statement-in-unix/7097.html

if statement www.computing.net/answers/unix/if-statement/6676.html

While read is ignoring if statement www.computing.net/answers/unix/while-read-is-ignoring-if-statement/7435.html