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

Square brackets

Status
Not open for further replies.

IMAUser

Technical User
May 28, 2003
121
CH
Hi ,

In UNIX shell scripting, I have seen double and single square brackets.
eg . if [[ $VAR -eq $VALUE ]] then
....
fi
As well as
if [ $VAR -eq $VALUE ] then
...
fi

Can someone tell me where to use double brackets and why.

Thanks.
 
Hi,

The [[ ]] construct is the shell equivalent of [ ]. This is the extended test command, adopted from ksh88.

Also, oo expansion or word splitting takes place between [[ and ]], but there is parameter expansion and command substitution.

HTH


William
Software Engineer
ICQ No. 56047340
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top