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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please explain what the ! does in this script

Status
Not open for further replies.

smith364

IS-IT--Management
Jun 26, 2001
34
US
If ! ./usr/sbin/"any command"
then
command, command ....
else
command


 
! = Not on the returncode from the command

# more tst1
ls tst1
echo $?
! ls tst1
echo $?
# ./tst1
tst1
0
tst1
1
 
Guess I should have said it better.

In your case it is saying, If the command fails do (then) if it is successful do (else). Hope that makes it a little clearer.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top