
01-03-2009
|
|
Shell programmer, author
|
|
|
Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
|
|
Quote:
Originally Posted by em23
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
|
|