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 9372
- From: "Artur Penttinen" <arto-p@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: trying to match yyyy-mm-dd what am I missing?
- Date: Fri, 2 Sep 2005 23:34:44 +0400 (MSD)
- In-reply-to: <A69FA3A4-3DC4-4D1D-BFC3-B9029D816043@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <A69FA3A4-3DC4-4D1D-BFC3-B9029D816043@xxxxxxxxxxxx>
- Reply-to: arto-p@xxxxxxxxx
- Sender: arto-p@xxxxxxxxx
>I am trying to match all folders in the CWD which are in the format
>YYYY-MM-DD.
>
>Actually I'm just trying to match the ones from 2000 so I am using
>
>2[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]
>
>as my regex.
>
>This is my script:
>
>for i in *
>do
>
>if [ -d "$i" ]
> then
> if [ "$i" = 2[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] ]
> then
> echo "YES: $i"
> else
> echo "no: $i"
> fi
>fi
>
>done
>
>Here are the results:
>
>YES: 2005-08-24/
>no: 2005-08-26/
>no: 2005-08-27/
>no: 2005-08-28/
>no: 2005-08-29/
>no: access.log/
# mkdir 2005-08-24 2005-08-26 2005-08-27 2005-08-28 2005-08-29 access.log
# for i in *(/); do [[ $i == 2[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] ]] && print "$i YES" || print "$i NO"; done
2005-08-24 YES
2005-08-26 YES
2005-08-27 YES
2005-08-28 YES
2005-08-29 YES
access.log NO
--
wbw, artur
Messages sorted by:
Reverse Date,
Date,
Thread,
Author