bug-bash
[Top][All Lists]
Advanced

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

Odd results when mixing single and double quotes with exclam


From: era+bash
Subject: Odd results when mixing single and double quotes with exclam
Date: Fri, 11 Oct 2002 13:27:28 +0300

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H   -I.  
-I/home/doko/packages/bash/bash-2.05a 
-I/home/doko/packages/bash/bash-2.05a/include 
-I/home/doko/packages/bash/bash-2.05a/lib -g -O2
uname output: Linux there.afraid.org 2.2.17 #1 Sun Jun 25 09:24:41 EST 2000 
i586 unknown
Machine Type: i386-pc-linux-gnu

Bash Version: 2.05a
Patch Level: 0
Release Status: release

 $ dpkg -s bash
 Package: bash
 Essential: yes
 Status: install ok installed
 Priority: required
 Section: base
 Installed-Size: 872
 Maintainer: Matthias Klose <doko@debian.org>
 Version: 2.05a-11
 Replaces: bash-doc (<= 2.05-1), bash-completion
 Depends: base-files (>= 2.1.12)
 Pre-Depends: libc6 (>= 2.2.4-4), libncurses5 (>= 5.2.20020112a-1)
 Conflicts: bash-completion
 Conffiles:
  /etc/bash.bashrc e218a2979b01db4e9c3ae19c94294a57
  /etc/bash_completion 5769c2f29cbbc0bde1cf2996ec6231ec
  /etc/skel/.bash_profile d8e9ecd0b80102c82966a045544bbf68
  /etc/skel/.bashrc e9d2739d6f3d7672222c07d901d46e21
 Description: The GNU Bourne Again SHell
  Bash is an sh-compatible command language interpreter that executes
  commands read from the standard input or from a file.  Bash also
  incorporates useful features from the Korn and C shells (ksh and csh).
  .
  Bash is ultimately intended to be a conformant implementation of the
  IEEE POSIX Shell and Tools specification (IEEE Working Group 1003.2).

Description:
        According to my understanding of the shell's quoting rules,
        single quotes should protect exclamation points, and pasting
        double quoted expressions adjacent to single quoted expressions
        should produce one quoted token, according to the respective
        rules of single and double quotes.

        Given that the following work as expected

 bash$ echo "'"'"'
 '"

 bash$ echo '!'
 !

 bash$ echo '!"'"'"
 !"'

 bash$ echo "!"  # expect error -- double quotes don't block history expansion
 bash: !": event not found

 bash$ bash <<'HERE'
 > echo "'"'"!'
 > HERE
 '"!

        ... I cannot understand why I get an error from this:

 bash$ echo "'"'"!'
 bash: !': event not found

        It looks to me like the quoting is incorrectly parsed in this
        example. However, I have not looked into how exactly.

Repeat-By:
        See above.

Fix:
        No idea, look into the interplay of history expansion and quotes?

        Some of the working examples above hint at acceptable
        workarounds for most situations.

/* era */

-- 
   tee -a $HOME/.signature <$HOME/.plan >http://www.iki.fi/era/index.html




reply via email to

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