[wplug] Stupid BASH Question
William Powell
billpwl1 at comcast.net
Thu Jul 3 11:12:23 EDT 2003
You might also want to check the Advanced Bash Scripting Guide -
http://markdude.members.wplug.org/LDP/abs/html/index.html
Bill
>On Thu, 2003-07-03 at 10:50, 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.
>>
>>
More information about the wplug
mailing list