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

Re: avoid errors on expansion failure



Eric Smith <es@xxxxxxxxxxxx> wrote in
news:mailbox-19078-1402649032-929168@pepper.0.0.200: 

> I wanted to scp recent files of certain types and the command failed
> if there were no expansions that met the conditions like this;
> [eric@bigmac ~] $ scp
> p:'*.{pptx,ppt,docx,doc,xlsx,xls,pdf,html,txt}(m-30)' . zsh:1: no
> matches found: *.ppt(m-30) [eric@bigmac ~] $ scp
> p:'*.{pptx,docx,doc,xlsx,xls,pdf,html,txt}(m-30)' . zsh:1: no matches
> found: *.xls(m-30) [eric@bigmac ~] $ scp
> p:'*.{pptx,docx,doc,xlsx,pdf,html,txt}(m-30)' . zsh:1: no matches
> found: *.html(m-30) [eric@bigmac ~] $ scp
> p:'*.{pptx,docx,doc,xlsx,pdf,txt}(m-30)' . foobar.pptx          100% 
> 348KB 347.5KB/s   00:00 
> 
> How do I make the command ignore this and to run first time?

don't know if this helps your case
> 
/tmp > touch fred.jpg

/tmp > ls *.{jpg,gif}(N)

fred.jpg

/tmp > ls *.{jpg,gif}

ls: cannot access *.gif: No such file or directory

fred.jpg



However watchout if *.{jpg,gif} returns nothing it will list all the 
files!!


-- 
zzapper
https://twitter.com/dailyzshtip

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com




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