[wplug] Stupid BASH Question

Wise, Jeremey WISEJ at PIOS.com
Thu Jul 3 10:50:34 EDT 2003


Ok, I thought this was going to be a simple thing. All I want to do is check
if a file exists. If it does then do the command, otherwise do something
else. I thought the syntax was similar to the if [ ! -d /directory ] but a
-z .... apparently not:>) Man bash yield no clue... as I thought that is
where I got the -z idea.

****************************
[root at toybox backup]# cat test.scp
#! /bin/bash
if [ -z /etc/fstab ] ; then
   printf "File /etc/fstab exists" ;else
   printf "File Missing"
fi
*****************************
This only prints out "File Missing" but obviously /etc/fstab does exist.

Thanks in advance,

Jeremey Wise (440)-519-6006
(CNE,MCSE,CSE)
Pioneer-Standard Electronics, Inc
wisej at pios.com



More information about the wplug mailing list