zsh-users
 help / color / mirror / code / Atom feed
From: "Artur Penttinen" <arto-p@yandex.ru>
To: zsh-users@sunsite.dk
Subject: Re: trying to match yyyy-mm-dd what am I missing?
Date: Fri, 2 Sep 2005 23:34:44 +0400 (MSD)	[thread overview]
Message-ID: <4318A954.000001.16955@camay.yandex.ru> (raw)
In-Reply-To: <A69FA3A4-3DC4-4D1D-BFC3-B9029D816043@tntluoma.com>

>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


  reply	other threads:[~2005-09-02 19:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-02 19:20 Timothy Luoma
2005-09-02 19:34 ` Artur Penttinen [this message]
2005-09-03  2:15 ` Clint Adams
2005-09-03 13:04 ` Geoff Wing
2005-09-03 19:01   ` Timothy Luoma
2005-09-04  6:59     ` Artur Penttinen
2005-09-03 19:06   ` Timothy Luoma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4318A954.000001.16955@camay.yandex.ru \
    --to=arto-p@yandex.ru \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).