Weird behaviour on echo

Jeff Vian jvian10 at charter.net
Mon Jul 18 05:35:34 UTC 2005


On Mon, 2005-07-18 at 00:56 +0200, Andy Pieters wrote:
> Hi all
> 
> Consider this
> 
> ~]$ echo "Test!"
> bash: !": event not found
> ~] $ echo "Test"!
> Test!
> ~] $ echo 'Test!'
> Test!
> ~] $ echo Test!
> Test!
> 
> I haven't heard anything about expansion of the '!' character, have you?

The ! is a special character in bash in some circumstances.  The "" can
give it the special meaning.

>From my documentation on bash,  !n references a previous command (the
nth command),  it also allows use of characters to list previously
issued (history) commands that start with that character(s)
an example of the first use
    [jeff at eye_gore ~]$ echo !12
    echo mkdir temp2
    mkdir temp2

and the second
   [jeff at eye_gore ~]$ echo !n
   echo ncftp 192.168.2.10
   ncftp 192.168.2.10

So in that context the "!" structure forces it to be interpreted with a
null argument and thus not a valid event to be referenced.
 
   [jeff at eye_gore ~]$ echo "!"
   bash: !: event not found
is in a slightly different category though

> With kind regards
> 
> 
> Andy
> 
> 
> -- 
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list




More information about the fedora-list mailing list