[Top][All Lists]

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

BASH bug CDPATH plus redirection

From: Chris
Subject: BASH bug CDPATH plus redirection
Date: Wed, 27 Jun 2001 19:11:32 +1000
User-agent: Mozilla/5.0 (X11; U; Linux 2.4.2 i686; en-US; 0.8) Gecko/20010217

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-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I. -I. -I./include -I./lib -I/usr/include -O2 -march=i386 -mcpu=i686 uname output: Linux tech.com.au 2.4.2 #22 Sun Apr 1 21:10:56 EST 2001 i686 unknown
Machine Type: i386-redhat-linux-gnu

Bash Version: 2.04
Patch Level: 11
Release Status: release

Problem #1:

In a shell script the "cd" command echos the directory when
the CDPATH is set. So for example, the command for copying
(cd dir1 ; tar cf - foo ) | (cd dir2 ; tar xf - )
will fail, because the first cd command will echo the
new directory thus corrupting the tar archive.
Not sure the correct solution here, but either not allow
inheriting CDPATH or disable the echoing for non-interactive
shells. Probably the latter.

Problem #2:

Redirections should be allowed both before and after a
command. i.e.
</etc/passwd cat
Ok, that works, but...
</etc/passwd (cat)
Fails, which is wrong. In other words, when you run a
sub-shell with the "(...)" syntax, it should still allow
redirections at the beginning. That allows you to more
easily convert the expression in Problem #1 to use temp
(cd dir1 ; tar cf - foo ) >foo.tar ; <foo.tar (cd dir2 ; tar xf - )
BTW, ash does this correctly, bash does not.

Please CC me on any discussions.

reply via email to

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