This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Delete a specific type of files when they exist.
- From: Eric Blake <ebb9 at byu dot net>
- To: cygwin at cygwin dot com, hongyi dot zhao at gmail dot com
- Date: Fri, 09 Jan 2009 06:12:27 -0700
- Subject: Re: Delete a specific type of files when they exist.
- References: <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/