Package: bash
Version: 3.0-14
Severity: wishlist
Tags: patch

See proposed patch. It is more robust to use && than "-a". 

  $ echo 1 > t.tmp
  $ set -x

See difference between these two:

  $ [ ! -r t.tmp ] && [ "$(cat t.tmp)" ]
  $ [ ! -r t.tmp   -a   "$(cat t.tmp)" ]

Results:

    + '[' '!' -r t.tmp ']'              (a)
    ++ cat t.tmp
    + '[' '!' -r t.tmp -a 1 ']'         (b)

The "-a" causes running all commands regardless of the left hand;
on the other hand "&&" always short circuits.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.10-1-686
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to en_US)

Versions of packages bash depends on:
ii  base-files              3.1.2            Debian base system miscellaneous f
ii  libc6                   2.3.2.ds1-20     GNU C Library: Shared libraries an
ii  libncurses5             5.4-4            Shared libraries for terminal hand
ii  passwd                  1:4.0.3-31sarge2 change and administer password and

-- no debconf information
cd /etc/skel/
diff -bwu /etc/skel/.bashrc.orig /etc/skel/.bashrc
--- /etc/skel/.bashrc.orig      2004-12-19 19:00:40.000000000 +0200
+++ /etc/skel/.bashrc   2005-04-08 12:03:43.023922400 +0300
@@ -29,9 +29,9 @@
 [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
 
 # set variable identifying the chroot you work in (used in the prompt below)
-if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
+if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
     debian_chroot=$(cat /etc/debian_chroot)
-fi
+i
 
 # set a fancy prompt (non-color, unless we know we "want" color)
 case "$TERM" in

Diff finished at Fri Apr  8 12:04:24

Reply via email to