Re: Weird behaviour on echo

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

 



On Mon, 18 Jul 2005, Andy Pieters wrote:

> ~]$ echo "Test!"
> bash: !": event not found
>
> I haven't heard anything about expansion of the '!' character, have you?

man bash (or csh, or any other shell):

    History expansion is performed immediately after a complete line is  read,
    before  the shell breaks it into words.  It takes place in two parts.  The
    first is to determine which line from the history list to use during  sub­
    stitution.   The  second  is to select portions of that line for inclusion
    into the current one.  The line selected from the history  is  the  event,
    and the portions of that line that are acted upon are words.  Various mod­
    ifiers are available to manipulate the selected words.  The line is broken
    into  words  in  the  same  fashion as when reading input, so that several
    metacharacter-separated words surrounded  by  quotes  are  considered  one
    word.   History expansions are introduced by the appearance of the history
    expansion character, which is ! by default.  Only backslash (\) and single
    quotes can quote the history expansion character.

    !      Start a history substitution, except when followed by a blank, new­
           line, = or (.
    !n     Refer to command line n.
    !-n    Refer to the current command line minus n.
    !!     Refer to the previous command.  This is a synonym for `!-1'.
    !string
           Refer to the most recent command starting with string.
    !?string[?]
           Refer to the most recent command containing string.  The trailing ?
           may be omitted if string is followed immediately by a newline.
    ^string1^string2^
           Quick  substitution.   Repeat  the  last command, replacing string1
           with string2.  Equivalent to ``!!:s/string1/string2/''  (see  Modi­
           fiers below).
    !#     The entire command line typed so far.

Looks like it's working as expected.  ;)

Damian Menscher
-- 
-=#| Physics Grad Student & SysAdmin @ U Illinois Urbana-Champaign |#=-
-=#| 488 LLP, 1110 W. Green St, Urbana, IL 61801 Ofc:(217)333-0038 |#=-
-=#| 4602 Beckman, VMIL/MS, Imaging Technology Group:(217)244-3074 |#=-
-=#| <menscher@xxxxxxxx> www.uiuc.edu/~menscher/ Fax:(217)333-9819 |#=-
-=#| The above opinions are not necessarily those of my employers. |#=-

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux