[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: examples in find's man page
From: |
Dale R. Worley |
Subject: |
Re: examples in find's man page |
Date: |
Sun, 17 Jul 2016 18:40:06 -0400 |
James Youngman <address@hidden> writes:
>> > find /sbin /usr/sbin -executable \! -readable -print
>>
>> let's escape ! here for no reason
>
> The interpretation of and quoting rules for ! have changed
> substantially over the years (for example, it is a reserved word in
> only some sh variants, and who knows how its precise interpretation
> varied over the lifetime of csh's parser), and I have developed the
> habit of quoting in more or less all circumstances.
My personal observation is that people use *, ?, and {} a lot more than
!, and they actually don't know the details of the quoting rules for !
in their favorite shell.
I just looked up that in the Posix shell command language, ! is only
special to the point of being a reserved word like 'if', i.e., it's only
magic when it's the first word of an apparent command.
In the bash shell, ! can also start a "history substitution", which has
the elegantly simple (NOT) specification:
! Start a history substitution, except when followed by a blank,
newline, carriage return, = or ( (when the extglob shell option
is enabled using the shopt builtin).
Dale