This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: bash programming: testing for empty string


try [ -z "$filetime" ] instead of [-z "$filetime"]

  matthias 



-----original message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]
Sent: Wednesday, 5. March 2008 10:28
To: cygwin@cygwin.com
Subject: bash programming: testing for empty string

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
...

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]