Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: trying to match yyyy-mm-dd what am I missing?
- X-seq: zsh-users 9378
- From: Geoff Wing <gcw@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: trying to match yyyy-mm-dd what am I missing?
- Date: Sat, 3 Sep 2005 13:04:40 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: PrimeNet Computer Consultants
- References: <A69FA3A4-3DC4-4D1D-BFC3-B9029D816043@xxxxxxxxxxxx>
- Reply-to: mason@xxxxxxxxxxxxxxx
Timothy Luoma <lists@xxxxxxxxxxxx> typed:
: I am trying to match all folders in the CWD which are in the format
: YYYY-MM-DD.
: if [ "$i" = 2[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] ]
This gets expanded to all the directories matching it. See
"CONDITIONAL EXPRESSIONS: ....
Normal shell expansion is performed on the file, string and pattern
arguments, but the result of each expansion is constrained to be a
single word, similar to the effect of double quotes."
You're trying to match each against (in your case with MARK_DIRS set)
"2005-08-24/ 2005-08-26/ 2005-08-27/ 2005-08-28/ 2005-08-29/"
Try a different solution, e.g.:
for i in *(^M)
do
if [ -d "$i" ]; then
case $i in
2[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]) echo "YES: $i";;
*) echo "no: $i" ;;
esac
fi
done
Regards,
--
Geoff Wing
Messages sorted by:
Reverse Date,
Date,
Thread,
Author