public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eric Blake <ebb9@byu.net>
To: cygwin@cygwin.com, hongyi.zhao@gmail.com
Subject: Re: Delete a specific type of files when they exist.
Date: Fri, 09 Jan 2009 14:18:00 -0000	[thread overview]
Message-ID: <49674D3B.20008@byu.net> (raw)
In-Reply-To: <rfidm4hfs5p9h6s40obf5s083onsau7j26@4ax.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Hongyi Zhao on 1/8/2009 8:55 PM:
> if [ -f *.cache-2 ] rm *.cache-2
> 
> But it seems that this -f parameter in the _if_ command will not work
> with wildcard, i.e., the  _[ -f *.cache-2 ]_ isn't a valid arg.  Any
> hints on this issue? 

Not cygwin specific.  Your problem is that using a glob can expand to more
than one argument, whereas "[ -f ... ]" expects exactly one argument in
place of ...; using echo will show you where you went wrong:

echo [ -f *.cache-2 ]

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklnTTsACgkQ84KuGfSFAYAIMQCgkGgi59V+gMaWTBoHt+IVg4eL
VmQAoILJS58ZpN1rNerzxw06WxY7ku/T
=bKCT
-----END PGP SIGNATURE-----

--
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/

  parent reply	other threads:[~2009-01-09 13:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09  4:20 Hongyi Zhao
2009-01-09  5:42 ` Yaakov (Cygwin/X)
2009-01-09  7:34   ` Hongyi Zhao
2009-01-09  9:31 ` Christopher Faylor
2009-01-09  9:41   ` Hongyi Zhao
2009-01-09 14:18 ` Eric Blake [this message]
2009-01-09 14:31   ` Hongyi Zhao
2009-01-09 15:18     ` Eric Blake
2009-01-10 11:59       ` Hongyi Zhao
2009-01-10 18:36         ` Eric Blake

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=49674D3B.20008@byu.net \
    --to=ebb9@byu.net \
    --cc=cygwin@cygwin.com \
    --cc=hongyi.zhao@gmail.com \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).