[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using -prune option of find to ignore hidden directories

Le quintidi 15 floréal, an CCXXV, Greg Wooledge a écrit :
> Bash has an option for this behavior (nullglob).  It's off by default
> because it produces extremely surprising results in interactive use.

For interactive use, the other other behaviour is obviously the best

~ $ ls *.c
zsh: no matches found: *.c
zsh: exit 1     ls --color=tty -FT0 *.c

Notice how zsh is reporting the error, not ls?

> Most of the traditional Unix commands are designed around the standard
> shell behavior of expanding a glob if possible, but leaving it untouched
> if it matches nothing.

This is completely untrue, fortunately.

> For example, rm(1):
> $ rm *.txy
> rm: cannot remove '*.txy': No such file or directory
> rm expects an expanded list of pathnames, and tries to remove each of
> them.  If one of them can't be removed, then it writes the argument
> as part of the error message, so you know which one it couldn't remove.

Case in point: rm does nothing special with globs.

Attachment: signature.asc
Description: Digital signature

Reply to: