[wplug] Stupid BASH Question

Robert Coutch robert.coutch at verizon.net
Thu Jul 3 11:07:07 EDT 2003


I believe you want to use -f for testing the existance of a regular file.

( Oh boy, finally a question I could answer !)

-Bob


On Thursday 03 July 2003 10:50 am, Wise, Jeremey wrote:
> 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
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug




More information about the wplug mailing list