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
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
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.
Summary: I have a file that consists of a blank line, then either Y or N and then another blank line. I want to take this into an if statement saying if the file contains a Y then do this else do that. I've tr...
Summary: I have written a scipt that will report when a drive is down, but i finding if the status of the drive is UP, then "while read LINE" ignores the IF statement. I want the script to print the echo "Al...