bug-bash
[Top][All Lists]
Advanced

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

Re: Escaping of exclamation marks inside quotes seems wrong


From: Bob Proulx
Subject: Re: Escaping of exclamation marks inside quotes seems wrong
Date: Thu, 18 Oct 2007 00:37:12 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

tmacieir@trolltech.com wrote:
>       When trying to produce an exclamation mark (!) inside a quoted
>       string is behaving differently from expected. I cannot see a
>       way of producing an exclamation mark inside a doubly-quoted
>       (") string in the bash prompt.

You are correct.  However that is inherited functionality of the
history mechanism as it came from csh.  Please see this message that
addresses exactly the same question.

  http://lists.gnu.org/archive/html/bug-bash/2007-10/msg00075.html

As a side note if the ! is followed immediately by a space, tab,
newline, carriage return or = then it can be embedded in a string.

  $ echo "foo! With a space following"
  foo! With a space following

If you never use history expansion then turning it off may be acceptable.

  $ set +o histexpand
  $ set -o | grep histexpand
  histexpand      off
  $ echo "!"
  !

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]