bash-2.05.0(1) bug or new feature
I've recently upgraded a number of systems to debian-woody, current
as of a couple of days ago, and run into a bug or a new feature
(I hope not) in bash-2.05.0(1) or some related library. This new
feature confounds an untold number of shell scripts.
The bash "cd" builtin now apparently echos its new CWD to standard out.
It did not do this, at least as of version 2.01.1(1) as found in
debian-slink.
If I have a directory named "test",
#!/bin/sh
cd test
in a script produces:
/home/dan/test
as its output. Well, that's OK, I don't really need the extra
screen noise, but I can live with it.
However, when cd is used in a script, this can have other consequences.
For example, a script intended to process all the leafnode names of some
files:
#!/bin/sh
(cd test; ls) | while read file
do
echo -- $file --
done
if run on a directory that contained files named 1, 2, and 3, once
produced
-- 1 --
-- 2 --
-- 3 --
but now produces
-- /home/dan/test --
-- 1 --
-- 2 --
-- 3 --
The common idiom
(cd /someplace; tar cf -) | tar xf -
will now fail. I could go on.
Is this a feature? Am I going to have to re-write all shell scripts
that assume a silent "cd" operation, or replace the stock build of
bash with a local build? Or switch to writing all scripts in csh?
Hoping somebody can furnish some insight.
--
-----------------------------------------------------------------
Dan Wilder <dan@ssc.com> Technical Manager & Editor
SSC, Inc. P.O. Box 55549 Phone: 206-782-8808
Seattle, WA 98155-0549 URL http://embedded.linuxjournal.com/
-----------------------------------------------------------------
Reply to: