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

Re: Globbing confusion



* 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



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