Re: bash quoting inconsistency

From: Dr Balwinder Singh Dheeman (bsd.sanspam_at_cto.homelinux.net)
Date: 10/25/04


Date: Mon, 25 Oct 2004 21:47:36 +0530

On 10/25/04 18:59, Peter T. Breuer wrote:
> Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
>
>>On 2004-10-25, Lawrence D?Oliveiro wrote:
>>
>>>There seems to be an inconsistency in bash in the interaction between
>>>"!", "\" and double quotes. On my SuSE 9.1 system
>>>(BASH_VERSION='2.05b.0(1)-release'), if I try the command
>>>
>>> echo "hi!"
>>>
>>>I get the error
>>>
>>> bash: !": event not found
>>
>> Only at the command line.
>>
>> In a script there is no expansion of the exclamation mark.
>
>
> I'd call that a bug - it's poor scanning of the string. Are you
> implying that pling expansion takes place BEFORE string scanning of any
> sort?
>
> (it may well, I don't know and I'm not looking it up ...)
>
> sh-2.03$ echo "hi!"
> sh: !": event not found
> sh-2.03$ ksh
> $ echo "hi!"
> hi!
> $
> $ csh
> nbd.it.uc3m.es% echo "hi!"
> ": Event not found.
> nbd.it.uc3m.es%
> nbd:/usr/oboe/ptb% echo "hi!"
> hi!
> nbd:/usr/oboe/ptb%
> % bash
> bash-2.03$ echo "hi!"
> bash: !": event not found
> bash-2.03$
>
>
> Looks to me that sh (bash) and csh are wrong, ksh and tcsh are right.

I have:

bash 2.05b-13 The GNU Bourne Again SHell
csh 20020413-1 Shell with C-like syntax, standard BSD shell
dash 0.4.21 The Debian Almquist Shell
pdksh 5.2.14-12 A public domain version of the Korn shell
sash 3.7-2 Stand-alone shell
tcsh 6.13.00-1 TENEX C Shell, an enhanced version of Berkel
zsh 4.2.1-5 A shell with lots of features

only bash is producing same error which the OP reported earlier, all
others giving me the desired output even on command line.

I mean both of my csh and tcsh are fine here.

-- 
Dr Balwinder Singh Dheeman            Registered Linux User: #229709
CLLO (Chief Linux Learning Officer)   Machines: #168573, 170593, 259192
Anu's Linux@HOME                      Distros: Knoppix, Fedora, FreeBSD
More: http://anu.homelinux.net/~bsd/  Visit: http://counter.li.org/


Relevant Pages

  • Re: Sort results different under bash and csh
    ... > bash or csh shell. ... > We had also problems with Fortran programs, ... > same regardless of shell. ...
    (comp.os.linux.misc)
  • Re: conversion of csh scripts to bash
    ... > I recognize that bash is the superior shell, but like many people, I was ... > first exposed to csh 12 years ago because that's what everyone in my ... Note that shell programming sucks in general, ... I would certainly not write bash specific scripts, but instead, ...
    (comp.unix.shell)
  • Re: BASH as root shell (static linking)
    ... I would suggest using bash as your toor shell instead. ... Yeah, I'v done that in the past, but I really dislike csh, I don't ...
    (freebsd-questions)
  • Re: Bash etc.
    ... or script called 'cd' or 'ls' in the current directory, and the shell ... how do I install tsch or csh? ... preferred anything but bash. ...
    (comp.os.linux.misc)
  • [gnu.bash.bug] BASH Frequently-Asked Questions (FAQ version 3.26)
    ... This is the Bash FAQ, version 3.26, for Bash version 2.05b. ... Bash, the GNU Bourne-Again Shell. ... C3) Which new features in ksh-93 are not in bash, ... D1) Why does bash run a different version of `command' than ...
    (comp.unix.shell)