if, test — Evaluate Conditions

Synopsis

/usr/bin/test [condition] 

[condition] 
sh
if condition; then action; fi 
if condition; then action; else action2; fi 
if condition; then action; elif condition2; then 
  action2; 
  ... ; fi 
if condition; then action; elif condition2; then action2; 
   ... ; else action3; fi 
test condition 
[condition] 
csh
if (condition) then 
  action 
else if (condition2) then 
  action2 
else 
  action3 
endif 

if (condition) action
						
ksh
if condition; then action; fi 
if condition; then action; else action2; fi 
if condition; then action; elif condition2; then action2; 
   ... ; fi 
if condition; then action; elif condition2; then action2; 
   ... ; else action3; fi 
test condition 
[condition] 

Description

When writing scripts, you frequently ...

Get Solaris™ 7 Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.