Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Globbing confusion



From: Jean-Rene David <jrdavid@xxxxxxxx>
Subject: Re: Globbing confusion
Date: Tue, 26 Sep 2006 00:24:23 -0400

> * Meino Christian Cramer [2006.09.25 23:15]:
> >  Besides others I want to to match all _directories_ matching the
> >  patterm mc-4.6.1* but dont want to remove _files_ of that pattern.
> > 
> >  And I dont want any errormessage, if a certain directory/file could
> >  not be found.
> 
> rm -rf mc-4.6.1*(/)
> 
> The "-f" option to "rm" will take care of the
> warnings.
> 
> >  For that purpose I tested on the commandline the following
> > 
> >      cd /tmp
> >      ls -ld ertertert(N/)    # ertertert does not exist under /tmp
> 
> When NULL_GLOB is set (as it is when using the "N" glob qualifier), the shell
> *deletes from the command line* any pattern which generates no match.
> 
> Your command becomes:
> 
> ls -ld
> 
> which prints the entry for the current directory (".") as expected.
> 
> >  In a script I would kill . in that case if "ls -ld" is replaced by
> >  "rm -rf" ???
> 
> No you wouldn't. Your command would become:
> 
> rm -rf
> 
> which does nothing.
> 
> -- 
> JR
> 

Hi JR,

 me again...

 I inserted 

   rm -rf /tmp/mc-4.6.1i*(/)

 into my cleanup-script for /tmp and executed it _twice_.

 First kills the directory, second run gives me:

      solfire:/home/mccramer>~/bin/cleantmp
	  /home/mccramer/bin/cleantmp:20: no matches found: /tmp/mc-4.6.1i*(/)

 Can I supress the warning also (other "rm -f"'s, which carry the (N)
 also does not print a warning when not found.)

 I tried the following:
 I mkdir a directory mc-4.6.1A and touch mc-4.6.1B then I did a 
 rm -rf /tmp/mc-4.6.1*(/N) from within a script. BOTH entries were
 removed. Only the directory should be removed.

 What I am confusing here so much ?

 Thank you very much in advance for any help !
 mcc





Messages sorted by: Reverse Date, Date, Thread, Author