This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Delete a specific type of files when they exist.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]