* "\rm -f" stops after the 1st glob not found
@ 2013-08-14 9:25 Leonardo Barbosa
2013-08-14 9:53 ` Peter Stephenson
2013-08-16 14:34 ` zzapper
0 siblings, 2 replies; 8+ messages in thread
From: Leonardo Barbosa @ 2013-08-14 9:25 UTC (permalink / raw)
To: zsh-users
Hello all,
I'm sure that's a simple questions, but the keywords are so common
that i couldn't find the answer by googling them.
My problem is this, when i type:
\rm -f *.aux *.blg *.out *.ps *.log *.toc *.tcp *.idx *.bak *.tps
*.ilg *.ind *.sty *.bst *.bbl
zsh stops in the first glob it doesn't find. How could i fix this?
Thanks in advance
Leo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "\rm -f" stops after the 1st glob not found
2013-08-14 9:25 "\rm -f" stops after the 1st glob not found Leonardo Barbosa
@ 2013-08-14 9:53 ` Peter Stephenson
2013-08-16 14:34 ` zzapper
1 sibling, 0 replies; 8+ messages in thread
From: Peter Stephenson @ 2013-08-14 9:53 UTC (permalink / raw)
To: zsh-users
On Wed, 14 Aug 2013 06:25:27 -0300
Leonardo Barbosa <barbosa.leonardo@gmail.com> wrote:
> I'm sure that's a simple questions, but the keywords are so common
> that i couldn't find the answer by googling them.
>
> My problem is this, when i type:
>
> \rm -f *.aux *.blg *.out *.ps *.log *.toc *.tcp *.idx *.bak *.tps
> *.ilg *.ind *.sty *.bst *.bbl
>
> zsh stops in the first glob it doesn't find. How could i fix this?
You need to change the options (using "setopt" in ~/.zshrc). There are
various things you can do.
setopt NULL_GLOB
simply removes completely all command line entries where the pattern
didn't expand to anything.
setopt CSH_NULL_GLOB
does the same, but if all patterns failed to expand it's an error (a bit
safer).
setopt NO_NOMATCH
leaves the argument unmodified --- this is what some other shells do, so
it might be your best bet. That means rm -f will try to remove files
called e.g. "*.bak", but the -f means that's OK.
There's a summary of all (well, some of) this in "From Bash to Z Shell"
chapter 9, page 211 (see www.bash2zsh.com for information about the
book).
pws
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "\rm -f" stops after the 1st glob not found
2013-08-14 9:25 "\rm -f" stops after the 1st glob not found Leonardo Barbosa
2013-08-14 9:53 ` Peter Stephenson
@ 2013-08-16 14:34 ` zzapper
2013-08-17 4:13 ` Bart Schaefer
1 sibling, 1 reply; 8+ messages in thread
From: zzapper @ 2013-08-16 14:34 UTC (permalink / raw)
To: zsh-users
Leonardo Barbosa <barbosa.leonardo@gmail.com> wrote in
news:CAMXWGTxJiYpsksFKfEi0=p+nj=O06YQorg3n5MOD8MpNxdQsjQ@mail.gmail.com:
> Hello all,
>
> I'm sure that's a simple questions, but the keywords are so common
> that i couldn't find the answer by googling them.
>
> My problem is this, when i type:
>
> \rm -f *.aux *.blg *.out *.ps *.log *.toc *.tcp *.idx *.bak *.tps
> *.ilg *.ind *.sty *.bst *.bbl
>
> zsh stops in the first glob it doesn't find. How could i fix this?
>
I have the following but it doesn't or no longer works??
ls *.{jpg,gif}(.N) # do not break if one or other image type absent
zzapper
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "\rm -f" stops after the 1st glob not found
2013-08-16 14:34 ` zzapper
@ 2013-08-17 4:13 ` Bart Schaefer
2013-08-17 11:11 ` zzapper
0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2013-08-17 4:13 UTC (permalink / raw)
To: zsh-users
On Aug 16, 2:34pm, zzapper wrote:
}
} I have the following but it doesn't or no longer works??
}
} ls *.{jpg,gif}(.N) # do not break if one or other image type absent
"Doesn't" in what way?
If you do that in a directory that has *neither* .jpg *nor* .gif files,
"ls" will be invoked with no arguments. Might that be what happened?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "\rm -f" stops after the 1st glob not found
2013-08-17 4:13 ` Bart Schaefer
@ 2013-08-17 11:11 ` zzapper
2013-08-17 13:36 ` Aaron Schrab
2013-08-17 19:42 ` Bart Schaefer
0 siblings, 2 replies; 8+ messages in thread
From: zzapper @ 2013-08-17 11:11 UTC (permalink / raw)
To: zsh-users
Bart Schaefer <schaefer@brasslantern.com> wrote in
news:130816211320.ZM27930@torch.brasslantern.com:
> ls *.{jpg,gif}(.N)
Bart,
Yeah that's what happened and confused me, of course if I was doing a
delete that would/could be disastrous
zzapper
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "\rm -f" stops after the 1st glob not found
2013-08-17 11:11 ` zzapper
@ 2013-08-17 13:36 ` Aaron Schrab
2013-08-17 14:01 ` zzapper
2013-08-17 19:42 ` Bart Schaefer
1 sibling, 1 reply; 8+ messages in thread
From: Aaron Schrab @ 2013-08-17 13:36 UTC (permalink / raw)
To: zsh-users
At 11:11 +0000 17 Aug 2013, zzapper <david@rayninfo.co.uk> wrote:
>Bart Schaefer <schaefer@brasslantern.com> wrote in
>news:130816211320.ZM27930@torch.brasslantern.com:
>
>> ls *.{jpg,gif}(.N)
>
>Bart,
>Yeah that's what happened and confused me, of course if I was doing a
>delete that would/could be disastrous
How so?
ls with no (non-option) arguments will list the current directory. rm
with no arguments won't delete anything, it will just display an error
message if the -f option wasn't used.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "\rm -f" stops after the 1st glob not found
2013-08-17 13:36 ` Aaron Schrab
@ 2013-08-17 14:01 ` zzapper
0 siblings, 0 replies; 8+ messages in thread
From: zzapper @ 2013-08-17 14:01 UTC (permalink / raw)
To: zsh-users
Aaron Schrab <aaron@schrab.com> wrote in news:20130817133600.GG10846
@pug.qqx.org:
> At 11:11 +0000 17 Aug 2013, zzapper <david@rayninfo.co.uk> wrote:
>>Bart Schaefer <schaefer@brasslantern.com> wrote in
>>news:130816211320.ZM27930@torch.brasslantern.com:
>>
>>> ls *.{jpg,gif}(.N)
>>
>>Bart,
>>Yeah that's what happened and confused me, of course if I was doing a
>>delete that would/could be disastrous
>
> How so?
>
> ls with no (non-option) arguments will list the current directory. rm
> with no arguments won't delete anything, it will just display an error
> message if the -f option wasn't used.
>
You are right you are corect all though ls lists the unmatched files rm
will not delete them with or without the -f.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: "\rm -f" stops after the 1st glob not found
2013-08-17 11:11 ` zzapper
2013-08-17 13:36 ` Aaron Schrab
@ 2013-08-17 19:42 ` Bart Schaefer
1 sibling, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 2013-08-17 19:42 UTC (permalink / raw)
To: zsh-users
On Aug 17, 11:11am, zzapper wrote:
}
} Yeah that's what happened and confused me
If you would prefer to get the "no match" error, write it like this:
% ls *.(jpg|gif)(.)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-08-17 19:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-14 9:25 "\rm -f" stops after the 1st glob not found Leonardo Barbosa
2013-08-14 9:53 ` Peter Stephenson
2013-08-16 14:34 ` zzapper
2013-08-17 4:13 ` Bart Schaefer
2013-08-17 11:11 ` zzapper
2013-08-17 13:36 ` Aaron Schrab
2013-08-17 14:01 ` zzapper
2013-08-17 19:42 ` Bart Schaefer
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).