Re: Quick question: mv !(file) !$

2009-01-13 Thread Chet Ramey
Yang Zhang wrote:

> So it's failing on the first bang?  But there is no problem once I
> replace !$ with 'dhclient' - usually extglob seems to work fine with the
> suppression of history expansion.  Or does the presence of !$ somehow
> trigger history expansion (normally not run) which then attempts to
> history-expand everything?

Essentially the latter.  The presence of !$ causes execution to proceed
to a point where the check for !( was omitted.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




Re: Quick question: mv !(file) !$

2009-01-13 Thread Yang Zhang

Chet Ramey wrote:

Yang Zhang wrote:

Hi, why doesn't the second command work?  (Trying to move all files into
a newly created directory.)

$ mkdir dhclient
$ mv !(dhclient) !$
bash: !: event not found


It doesn't work because enabling the `extglob' option doesn't cause bash
to tell the history library to not attempt history expansion when it sees
the history expansion character followed by a `('.  This will be fixed in
bash-4.0 or soon after.

Chet



So it's failing on the first bang?  But there is no problem once I 
replace !$ with 'dhclient' - usually extglob seems to work fine with the 
suppression of history expansion.  Or does the presence of !$ somehow 
trigger history expansion (normally not run) which then attempts to 
history-expand everything?

--
Yang Zhang
http://www.mit.edu/~y_z/




Re: Quick question: mv !(file) !$

2009-01-12 Thread Chet Ramey
Yang Zhang wrote:
> Hi, why doesn't the second command work?  (Trying to move all files into
> a newly created directory.)
> 
> $ mkdir dhclient
> $ mv !(dhclient) !$
> bash: !: event not found

It doesn't work because enabling the `extglob' option doesn't cause bash
to tell the history library to not attempt history expansion when it sees
the history expansion character followed by a `('.  This will be fixed in
bash-4.0 or soon after.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/




Quick question: mv !(file) !$

2009-01-08 Thread Yang Zhang
Hi, why doesn't the second command work?  (Trying to move all files into 
a newly created directory.)


$ mkdir dhclient
$ mv !(dhclient) !$
bash: !: event not found

--
Yang Zhang
http://www.mit.edu/~y_z/