This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: bash programming: testing for empty string
- From: "Morche Matthias" <Matthias dot Morche at P7S1Produktion dot de>
- To: <cygwin at cygwin dot com>
- Date: Wed, 5 Mar 2008 10:45:42 +0100
- Subject: 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/