The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 01-03-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by em23 View Post
Do you mean test, like so:

test is a synomym for [.
Quote:
Code:
test -d /etc/dmi/conf
if [ "$?" -eq 0 ]

That's the same as

Code:
test -d /etc/dmi/conf
if test "$?" -eq 0
It would normally be written as:

Code:
if test -d /etc/dmi/conf
Or:

Code:
if [ -d /etc/dmi/conf ]
Quote:
Code:
then
   print '/etc/dmi/conf does exist'
else
   print '/etc/dmi/conf does NOT exist'
fi
and when executed...
em23@sparky:~$ ./test.sh
/etc/dmi/conf does exist