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

Re: Suppressing "no matches found" Glob Message?



    Hi Bart :)

 * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> >     In certain sense, what you want is impossible. If you issue the 'ls' 
> > command with parameters, it will list those parameters (if they exist), 
> > but if you don't give it params, it will list all files and dirs. You 
> > cannot have a way of 'ls' shutting its mouth up if the pattern doesn't 
> > match anything.
> Well, no, but you can have zsh not call "ls" in the first place if the
> pattern doesn't match anything.

    Of course, but I think is faster to use 'find' or even 'print'
together with the stat module, instead of 'ls' and a monster command
line. That expansion **/*, can lead to a huge command line as you
point at the end of your message.

>  lspf() {
>    files=( **/*(.N) )
>    if (( $#files ))
>    then
>      ls $files
>    else 
>      print -u2 "Dude, where's my file?"
>    fi
>  }

    Nice :))))
 
> Of course, when I try that, I get "argument list too long: ls" but that's 
> a different issue.

    You can use xargs, of course, but then you can use 'find' in the
first place.

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/



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