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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.