* avoid errors on expansion failure
@ 2014-06-13 8:44 Eric Smith
2014-06-13 13:09 ` zzapper
0 siblings, 1 reply; 5+ messages in thread
From: Eric Smith @ 2014-06-13 8:44 UTC (permalink / raw)
To: zsh-users
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?
--
Eric Smith
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: avoid errors on expansion failure
2014-06-13 8:44 avoid errors on expansion failure Eric Smith
@ 2014-06-13 13:09 ` zzapper
2014-06-13 13:13 ` Eric Smith
0 siblings, 1 reply; 5+ messages in thread
From: zzapper @ 2014-06-13 13:09 UTC (permalink / raw)
To: zsh-users
Eric Smith <es@fruitcom.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: avoid errors on expansion failure
2014-06-13 13:09 ` zzapper
@ 2014-06-13 13:13 ` Eric Smith
2014-06-13 13:34 ` Mikael Magnusson
0 siblings, 1 reply; 5+ messages in thread
From: Eric Smith @ 2014-06-13 13:13 UTC (permalink / raw)
To: zsh-users
Thank you ...
> > 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
Nope, you are just updating the timestamp on the file, thereby
over-riding the time specification.
Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: avoid errors on expansion failure
2014-06-13 13:13 ` Eric Smith
@ 2014-06-13 13:34 ` Mikael Magnusson
2014-06-13 13:43 ` Eric Smith
0 siblings, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2014-06-13 13:34 UTC (permalink / raw)
To: Eric Smith; +Cc: Zsh Users
On 13 June 2014 15:13, Eric Smith <Eric.Smith@biovolt.nl> wrote:
> Thank you ...
>
>> > 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
>
> Nope, you are just updating the timestamp on the file, thereby
> over-riding the time specification.
You probably misunderstood the whole point then, touch creates a file
only for the purpose of demonstrating the commands that follow.
However, I would recommend using the (foo|bar|baz) syntax rather than
{foo,bar,baz} as it is a single glob expression that doesn't need any
additional (N) flags to not fail and no caveat when none of the
patterns match.
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: avoid errors on expansion failure
2014-06-13 13:34 ` Mikael Magnusson
@ 2014-06-13 13:43 ` Eric Smith
0 siblings, 0 replies; 5+ messages in thread
From: Eric Smith @ 2014-06-13 13:43 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: Zsh Users
Mikael Magnusson wrote on Fri-13-Jun 14 3:34PM
> >> don't know if this helps your case
> >> >
> >> /tmp > touch fred.jpg
> >
> > Nope, you are just updating the timestamp on the file, thereby
> > over-riding the time specification.
>
> You probably misunderstood the whole point then, touch creates a file
> only for the purpose of demonstrating the commands that follow.
Indeed, I just saw "touch" and was put off (without reading
the rest).
Thanks to you both.
Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-13 13:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 8:44 avoid errors on expansion failure Eric Smith
2014-06-13 13:09 ` zzapper
2014-06-13 13:13 ` Eric Smith
2014-06-13 13:34 ` Mikael Magnusson
2014-06-13 13:43 ` Eric Smith
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).