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 9380
- From: Timothy Luoma <lists@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: trying to match yyyy-mm-dd what am I missing?
- Date: Sat, 3 Sep 2005 15:06:54 -0400
- In-reply-to: <slrndhj7r8.8pe.mason@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <A69FA3A4-3DC4-4D1D-BFC3-B9029D816043@xxxxxxxxxxxx> <slrndhj7r8.8pe.mason@xxxxxxxxxxxxxxxxx>
On Sep 3, 2005, at 9:04 AM, Geoff Wing wrote:
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."
I could have read that 1,000 times and not understood that it applied
to my situation.
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
Ah! That works! Thanks.
I am using this, together with the previous script about getting the
creation date, to easily sort folders with lots of stuff in them into
folders with contents organized by creation date.
Thanks!
TjL
Messages sorted by:
Reverse Date,
Date,
Thread,
Author