zsh-users
 help / color / mirror / code / Atom feed
* rm -r
@ 1999-12-20 15:31 Claus Alboege
  1999-12-20 15:41 ` Vincent Lefevre
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Claus Alboege @ 1999-12-20 15:31 UTC (permalink / raw)
  To: zsh-users

Hi,

Could anyone tell me a way to make the following work from a z-shell:

rm -rf *.o (this dosn't work)

What I want is to remove all .o files recursive , but the "-r switch" in
the above isn't a correct way to do it.

-- 
 Claus Alboege


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-20 15:31 rm -r Claus Alboege
@ 1999-12-20 15:41 ` Vincent Lefevre
  1999-12-20 15:43 ` Clint Adams
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Vincent Lefevre @ 1999-12-20 15:41 UTC (permalink / raw)
  To: zsh-users

On Mon, Dec 20, 1999 at 16:31:34 +0100, Claus Alboege wrote:
> Could anyone tell me a way to make the following work from a z-shell:
> 
> rm -rf *.o (this dosn't work)
> 
> What I want is to remove all .o files recursive , but the "-r switch" in
> the above isn't a correct way to do it.

rm -f **/*.o

or with *** instead of ** to follow the links.

See man zshexpn...

-- 
Vincent Lefèvre <vincent@vinc17.org> - PhD student in Computer Science
Web: <http://www.vinc17.org/> or <http://www.ens-lyon.fr/~vlefevre/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-20 15:31 rm -r Claus Alboege
  1999-12-20 15:41 ` Vincent Lefevre
@ 1999-12-20 15:43 ` Clint Adams
  1999-12-20 16:13 ` Pascal Byrne
  1999-12-20 16:28 ` fg
  3 siblings, 0 replies; 12+ messages in thread
From: Clint Adams @ 1999-12-20 15:43 UTC (permalink / raw)
  To: Claus Alboege; +Cc: zsh-users

> Could anyone tell me a way to make the following work from a z-shell:
> 
> rm -rf *.o (this dosn't work)
> 
> What I want is to remove all .o files recursive , but the "-r switch" in
> the above isn't a correct way to do it.

rm -f **/*.o
might work a little better


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-20 15:31 rm -r Claus Alboege
  1999-12-20 15:41 ` Vincent Lefevre
  1999-12-20 15:43 ` Clint Adams
@ 1999-12-20 16:13 ` Pascal Byrne
  1999-12-20 16:28 ` fg
  3 siblings, 0 replies; 12+ messages in thread
From: Pascal Byrne @ 1999-12-20 16:13 UTC (permalink / raw)
  To: Claus Alboege; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]

*.o is interpreted by zsh as: expand all the filnames in the current
directory matching '*.o' and the pass these as arguments to 'rm' which isn't
what you want (try pressing <tab> to see the expansion).

If there are a small number of files try:
  rm -f **/*.o
or if the expansion will result in more file names than can be passed on the
command line:
  find . -name '*.o' | xargs rm -f

-pascal


Claus Alboege wrote:

> Hi,
>
> Could anyone tell me a way to make the following work from a z-shell:
>
> rm -rf *.o (this dosn't work)
>
> What I want is to remove all .o files recursive , but the "-r switch" in
> the above isn't a correct way to do it.
>
> --
>  Claus Alboege

[-- Attachment #2: Card for Pascal Byrne --]
[-- Type: text/x-vcard, Size: 275 bytes --]

begin:vcard 
n:Byrne;Pascal
tel;fax:353 1 8039101 
tel;work:353 1 8039066
x-mozilla-html:FALSE
org:Oracle;WPTG
version:2.1
email;internet:pbyrne@ie.oracle.com
adr;quoted-printable:;;Block 3,=0D=0AEast Point business park,=0D=0ADublin 3.;;;;Ireland
fn:Pascal Byrne 
end:vcard

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-20 15:31 rm -r Claus Alboege
                   ` (2 preceding siblings ...)
  1999-12-20 16:13 ` Pascal Byrne
@ 1999-12-20 16:28 ` fg
  1999-12-21 14:31   ` Andre Pang
  3 siblings, 1 reply; 12+ messages in thread
From: fg @ 1999-12-20 16:28 UTC (permalink / raw)
  To: Claus Alboege; +Cc: zsh-users

Claus Alboege <tractrix@kom.auc.dk> writes:

> Hi,
> 
> Could anyone tell me a way to make the following work from a z-shell:
> 
> rm -rf *.o (this dosn't work)
> 
> What I want is to remove all .o files recursive , but the "-r switch" in
> the above isn't a correct way to do it.
> 

find -type f -name "*.o" -exec rm -f {} \;

Or:

rm -f **/*.o with zsh's goodies, But you'll get a "blah.o: is a
directory" message if you have directories which names end with ".o"


-- 
fg

# rm *;o
o: command not found


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-20 16:28 ` fg
@ 1999-12-21 14:31   ` Andre Pang
  1999-12-21 18:52     ` fg
  0 siblings, 1 reply; 12+ messages in thread
From: Andre Pang @ 1999-12-21 14:31 UTC (permalink / raw)
  To: fg; +Cc: Claus Alboege, zsh-users

On Mon, Dec 20, 1999 at 05:28:20PM +0100, fg wrote:

> > What I want is to remove all .o files recursive , but the "-r switch" in
> > the above isn't a correct way to do it.
> > 
> 
> find -type f -name "*.o" -exec rm -f {} \;
> 
> Or:
> 
> rm -f **/*.o with zsh's goodies, But you'll get a "blah.o: is a
> directory" message if you have directories which names end with ".o"

    rm -f **/*.o(^/) will work if you've doing 'setopt EXTENDED_GLOB', too. 
(That'll remove all files which end in .o recursively, and exclude all *.o
files which are directories).


-- 
: Andre Pang <andrep@vjolnir.org> - Purruna Pty Ltd - ph# 0411.882299 :
:               #ozone - http://www.vjolnir.org/ozone/                :


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-21 14:31   ` Andre Pang
@ 1999-12-21 18:52     ` fg
  1999-12-22  3:51       ` Andre Pang
  1999-12-22  9:58       ` Thomas Köhler
  0 siblings, 2 replies; 12+ messages in thread
From: fg @ 1999-12-21 18:52 UTC (permalink / raw)
  To: Andre Pang; +Cc: Claus Alboege, zsh-users

Andre Pang <andrep-ml@vjolnir.org> writes:

> 
>     rm -f **/*.o(^/) will work if you've doing 'setopt EXTENDED_GLOB', too. 
> (That'll remove all files which end in .o recursively, and exclude all *.o
> files which are directories).
> 

Gee, this makes me look at "find" like an easy-to-use program ;)

BTW, whats the argument limit for zsh?

-- 
fg

# rm *;o
o: command not found


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-21 18:52     ` fg
@ 1999-12-22  3:51       ` Andre Pang
  1999-12-22  9:58       ` Thomas Köhler
  1 sibling, 0 replies; 12+ messages in thread
From: Andre Pang @ 1999-12-22  3:51 UTC (permalink / raw)
  To: fg; +Cc: Claus Alboege, zsh-users

On Tue, Dec 21, 1999 at 07:52:29PM +0100, fg wrote:

> >     rm -f **/*.o(^/) will work if you've doing 'setopt EXTENDED_GLOB', too. 
> > (That'll remove all files which end in .o recursively, and exclude all *.o
> > files which are directories).
> 
> Gee, this makes me look at "find" like an easy-to-use program ;)

    [advocacy] Actually, the only reason I don't know how to use find is
because of zsh.  Since it's my shell wherever I'm at, I tend to type stuff
like that in all the time :).  Once you've learnt the basic globbing stuff
(?, *, [], {}), the extended glob options are brilliant.. *(@) and a few
others in particular are so useful!  If you don't know them yet, I'd highly
advise learning them.


-- 
: Andre Pang <andrep@vjolnir.org> - Purruna Pty Ltd - ph# 0411.882299 :
:               #ozone - http://www.vjolnir.org/ozone/                :


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-21 18:52     ` fg
  1999-12-22  3:51       ` Andre Pang
@ 1999-12-22  9:58       ` Thomas Köhler
  1999-12-22 13:12         ` Alexandre Duret-Lutz
  1 sibling, 1 reply; 12+ messages in thread
From: Thomas Köhler @ 1999-12-22  9:58 UTC (permalink / raw)
  To: zsh-users; +Cc: zsh-workers

On Tue, Dec 21, 1999 at 07:52:29PM +0100,
fg <francis@mandrakesoft.com> wrote:
> 
> Andre Pang <andrep-ml@vjolnir.org> writes:
> 
> > 
> >     rm -f **/*.o(^/) will work if you've doing 'setopt EXTENDED_GLOB', too. 
> > (That'll remove all files which end in .o recursively, and exclude all *.o
> > files which are directories).
> > 
> 
> Gee, this makes me look at "find" like an easy-to-use program ;)

I'd say
ls **/*(.)
is much easier than
find . -type f -exec ls {} \;
You just need a little bit of experience with zsh's extended globbing.
(I hardly use find any more)

YMMV :)

> BTW, whats the argument limit for zsh?

jean-luc@picard (tty11) ~> /bin/echo $(repeat 32766 echo -n  "x " )
[lots of "x x x x "]
jean-luc@picard (tty11) ~> /bin/echo $(repeat 32767 echo -n  "x " )
zsh: argument list too long: /bin/echo

Ah, the limit is at 32766 arguments. (On Linux-i386)
Here's the few situations where I need find again... :)

Question to zsh-workers (Cc-ed):
Is there a special reason why only 32766 arguments are allowed? (that
is, 32766+1, the executable name, so - an unsigned short seems to be
used for counting the arguments - why not an int? Would be 2147483646
arguments on Linux)
(I currently don't read zsh-workers, so please Cc me or zsh-users if you
reply to this question. thanks)

CU,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de   | LCARS - Linux for
     <><        WWW:  http://home.pages.de/~jeanluc/ | Computers on All
                IRC:             jeanluc             | Real Starships
   PGP public key: http://www.mayn.de/users/jean-luc/PGP-Public.asc


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-22  9:58       ` Thomas Köhler
@ 1999-12-22 13:12         ` Alexandre Duret-Lutz
  1999-12-22 13:24           ` Thomas Köhler
  1999-12-23  0:15           ` Geoff Wing
  0 siblings, 2 replies; 12+ messages in thread
From: Alexandre Duret-Lutz @ 1999-12-22 13:12 UTC (permalink / raw)
  To: zsh-users; +Cc: Thomas Köhler

>>> "TK" == Thomas Köhler <jean-luc@picard.franken.de> writes:

 TK> On Tue, Dec 21, 1999 at 07:52:29PM +0100,
 TK> fg <francis@mandrakesoft.com> wrote:

[...]

 >> BTW, whats the argument limit for zsh?

This limit is not set by zsh but by the underlying libraries/OS.
Moreover (correct me if I'm wrong) it is usualy set in term of a limit
on the size of the environnement plus the size of the parameters (not
realy the number of these).

[...]

 TK> zsh: argument list too long: /bin/echo

This a standard message printed from `strerror(E2BIG)' after
`execve(...)' returned the error `E2BIG' to zsh.  In other words,
that's the C library speaking to you through zsh. 

 TK> Ah, the limit is at 32766 arguments. (On Linux-i386)

Well, for *you* and with this particular case of arguments list!

 TK> Here's the few situations where I need find again... :)

Since `echo' is builtin (therefore not exec'ed), you may want to do

echo PATTERN | xargs COMMAND

when `COMMAND PATTERN' don't work.

[...]

-- 
Alexandre Duret-Lutz



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-22 13:12         ` Alexandre Duret-Lutz
@ 1999-12-22 13:24           ` Thomas Köhler
  1999-12-23  0:15           ` Geoff Wing
  1 sibling, 0 replies; 12+ messages in thread
From: Thomas Köhler @ 1999-12-22 13:24 UTC (permalink / raw)
  To: zsh-users

On Wed, Dec 22, 1999 at 01:12:22PM +0000,
Alexandre Duret-Lutz <alexandre.duret@greyc.ismra.fr> wrote:
> 
> >>> "TK" == Thomas Köhler <jean-luc@picard.franken.de> writes:
> 
>  TK> On Tue, Dec 21, 1999 at 07:52:29PM +0100,
>  TK> fg <francis@mandrakesoft.com> wrote:
> 
> [...]
> 
>  >> BTW, whats the argument limit for zsh?
> 
> This limit is not set by zsh but by the underlying libraries/OS.
> Moreover (correct me if I'm wrong) it is usualy set in term of a limit
> on the size of the environnement plus the size of the parameters (not
> realy the number of these).

Ah. Now I understand this much better.

> [...]
> 
>  TK> zsh: argument list too long: /bin/echo
> 
> This a standard message printed from `strerror(E2BIG)' after
> `execve(...)' returned the error `E2BIG' to zsh.  In other words,
> that's the C library speaking to you through zsh. 

Yes, makes sense.

>  TK> Ah, the limit is at 32766 arguments. (On Linux-i386)
> 
> Well, for *you* and with this particular case of arguments list!

Right. Using different parameters, the limit (in
"number-of-arguments-allowed") was smaller.

>  TK> Here's the few situations where I need find again... :)
> 
> Since `echo' is builtin (therefore not exec'ed), you may want to do
> 
> echo PATTERN | xargs COMMAND
> 
> when `COMMAND PATTERN' don't work.

Cool idea. *very* cool.
Perhaps I should even build a cool preexec() that handles this? Perhaps
some time in the future...

> Alexandre Duret-Lutz

Thanks,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de   | LCARS - Linux for
     <><        WWW:  http://home.pages.de/~jeanluc/ | Computers on All
                IRC:             jeanluc             | Real Starships
   PGP public key: http://www.mayn.de/users/jean-luc/PGP-Public.asc


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: rm -r
  1999-12-22 13:12         ` Alexandre Duret-Lutz
  1999-12-22 13:24           ` Thomas Köhler
@ 1999-12-23  0:15           ` Geoff Wing
  1 sibling, 0 replies; 12+ messages in thread
From: Geoff Wing @ 1999-12-23  0:15 UTC (permalink / raw)
  To: zsh-users

Alexandre Duret-Lutz <alexandre.duret@greyc.ismra.fr> typed:
:Since `echo' is builtin (therefore not exec'ed), you may want to do
:echo PATTERN | xargs COMMAND

I hope everyone is aware of the whitespace in name problem with above.
Note also that ``print'' is also a builtin, and if your ``xargs'' has a
``-0'' flag or similar (separate on NUL '\0' instead of whitespace)
then you should be using

% print -N PATTERN | xargs -0 COMMAND

:when `COMMAND PATTERN' don't work.
:[...]

Regards,
-- 
Geoff Wing : <gcw@pobox.com>     Work URL: http://www.primenet.com.au/
Rxvt Stuff : <gcw@rxvt.org>      Ego URL : http://pobox.com/~gcw/
Zsh Stuff  : <gcw@zsh.org>       Phone   : (Australia) 0413 431 874


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1999-12-23  0:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-20 15:31 rm -r Claus Alboege
1999-12-20 15:41 ` Vincent Lefevre
1999-12-20 15:43 ` Clint Adams
1999-12-20 16:13 ` Pascal Byrne
1999-12-20 16:28 ` fg
1999-12-21 14:31   ` Andre Pang
1999-12-21 18:52     ` fg
1999-12-22  3:51       ` Andre Pang
1999-12-22  9:58       ` Thomas Köhler
1999-12-22 13:12         ` Alexandre Duret-Lutz
1999-12-22 13:24           ` Thomas Köhler
1999-12-23  0:15           ` Geoff Wing

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).