delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <454BA875.6BFC70AF@dessent.net> |
Date: | Fri, 03 Nov 2006 12:37:09 -0800 |
From: | Brian Dessent <brian AT dessent DOT net> |
X-Mailer: | Mozilla 4.79 [en] (Windows NT 5.0; U) |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Simple rm question, removing files that end with a tilde even if they start with a dot |
References: | <eig8lc$ugb$1 AT sea DOT gmane DOT org> |
X-IsSubscribed: | yes |
Reply-To: | cygwin AT cygwin DOT com |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Eric Lilja wrote: > Why doesn't this work? I want to remove .bashrc~ (ls has been aliased to > include -AF): > hivemind AT mindcooler ~ > $ ls > .bash_history .bashrc* .emacs* .emacs.elc* .ssh/ > .bash_profile* .bashrc~* .emacs.d/ .inputrc* coding/ > > hivemind AT mindcooler ~ > $ rm *~ > rm: cannot remove `*~': No such file or directory > > Obviously I can remove it by naming the file explicitly but I want to > know why the lines I pasted above doesn't work so I learn something. :-) > rm has not been aliased By default, the shell does not include filenames beginning with '.' during glob-expansion. The reason it is listed with 'ls' is because in that case, there is no glob being expanded, but rather you've supplied no filenames to 'ls' and told it explicitly to list the entire contents of the directory with -A. If you had used a glob instead (such as by typing "ls -A *" or more usefully "ls -Ad *") you would not have seen the filenames beginning with dot, because in this case it is the shell that determines which files get listed, not 'ls', so the -A would have been irrelevant. If you want globbing to match filenames beginning with . you need to either set the dotglob shopt (see man bash) or you need to use a glob such as .*~ instead of *~. This is all generic shell behavior and is not specific to Cygwin in any way. Brian -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |