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

Re: Suppressing "no matches found" Glob Message?



¡Hola Raúl!


DervishD <raul@xxxxxxxxxxxx> writes:

> [ ... ]
>
>  * Aaron Davies <agdavi01@xxxxxxxxxxxxxx> dixit:
>> That wouldn't be so bad, actually; I could redirect that error to 
>> /dev/null. So, does anyone know how to set that option in a pattern?
>
>     I don't know. I've took a look at the manual and I haven't found
> anything about it. Anyway, if you are using such pattern you're bound
> to zsh, so, why not using 'print' instead of 'ls'? Using the 'stat'
> module of zsh will give you all information 'ls' gives.
>
>     Otherwise, your solution of redirecting the error is good. You
> just need a shell function in order to set the NOMATCH option,
> something like (I'm writing on the fly, so it's untested):
>
>     function special_ls() {
>
>         emulate -L zsh
>         setopt NOMATCH
>
>         ls **/*(.) >& /dev/null
>
>         return 0
>     }


That will print nothing _except_ a possible error message!

How about this?

    function special_ls() {

        emulate -L zsh
        setopt NOMATCH

        { ls **/*(.) } 2>/dev/null

        return 0
    }


-- 
 Lloyd Zusman
 ljz@xxxxxxxxxx
 God bless you.



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