RE: bash programming: testing for empty string

2008-03-05 Thread Phil Betts
bootleg86 wrote on Wednesday, March 05, 2008 9:28 AM:: > Hi, > > I'm trying to find the time of a file by doing this. > > filetime=`ls -l --time-style=+%a:%H:%M /tmp/1.txt | awk '{print $6}'` > > if [ -z "$filetime"]; then > echo "File does not exist" > else > echo "Time file: $filetime" > fi

RE: bash programming: testing for empty string

2008-03-05 Thread Morche Matthias
try [ -z "$filetime" ] instead of [-z "$filetime"] matthias -original message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, 5. March 2008 10:28 To: cygwin@cygwin.com Subject: bash programming: testing for empty string Hi, I'm trying t

bash programming: testing for empty string

2008-03-05 Thread bootleg86 bootleg86
Hi, I'm trying to find the time of a file by doing this. filetime=`ls -l --time-style=+%a:%H:%M /tmp/1.txt | awk '{print $6}'` if [ -z "$filetime"]; then echo "File does not exist" else echo "Time file: $filetime" fi However, when the file does not exist and filetime returns an empty string,