Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Aug 2000 19:13:50 -0500
From:      Jon Hamilton <hamilton@pobox.com>
To:        "Philip M. Gollucci" <gollucci@wam.umd.edu>
Cc:        Evren Yurtesen <yurtesen@ispro.net.tr>, freebsd-questions@FreeBSD.ORG
Subject:   Re: how to delete all files but the XYZ file. 
Message-ID:  <20000827001352.AB0DB137@woodstock.monkey.net>
In-Reply-To: Your message of "Sat, 26 Aug 2000 19:11:09 EDT." <Pine.GSO.4.21.0008261910550.2298-100000@rac1.wam.umd.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help

In message <Pine.GSO.4.21.0008261910550.2298-100000@rac1.wam.umd.edu>, "Philip 
M. Gollucci" wrote:

[ discussion of how to remove all but a few files from a directory ]

} the rm command supports regex expressions.

No, it doesn't, for two reasons; both may seem nit-picky but the distinction
is important.

First, what you're talking about are shell globs, not regexes.  They're
not interchangable (that's the more esoteric argument).  Secondly, those
globs are interpreted by the _shell_, not by the rm command.  This may
not make much difference to the end user, but it's important to understand
in the framework of UNIX.  Commands don't do this kind of expansion themselves,
they just take what the shell hands them.  In this way, commands all behave
the same way when it comes to parameter expansion.  When you say:

$ rm *foo

the shell actually expands *foo and hands the result off to rm.

-- 
   Jon Hamilton  
   hamilton@pobox.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000827001352.AB0DB137>