Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Basic I/O redirection broken in ZSH 4.04/4.06



Greetings All,

	Attached is a simple shell script which demostrates the issue I
discovered on the command line yesterday. The output from Solaris 8
(x86) is included for all bourne shell derived shells as well as
zsh-4.0.4 and zsh-4.0.6 (note also that Sun supplied 3.0.6 also has
this bug)

	The bug involves ignoring the output of a command and simply using
stderr as the source for a pipe as in :
	cmd 2>&1 >/dev/null | cmd

	The problem is that zsh does not redirect stdout to /dev/null like
every other shell :-(

	The script and example below fully demostrate the problem

Regards,
Peter Bray
Sydney, Australia


[software@porta] % cat zsh-redirect-bug 

# Setup
testdir=/tmp/test.$$
mkdir ${testdir}
cd ${testdir}

touch file1
touch file2
ln -s somewhere1 symlink1
ln -s somewhere2 symlink2

# Test

ls -lL 2>&1 1>/dev/null | awk -F: '{print $1}'

# Cleanup
cd
rm -rf ${testdir}

[software@porta] % /pkgs/zsh-4.0.4/bin/zsh zsh-redirect-bug 
./symlink1
./symlink2
total 0
-rw-r--r--   1 software software       0 Sep  1 15
-rw-r--r--   1 software software       0 Sep  1 15

[software@porta] % /pkgs/zsh-4.0.6/bin/zsh zsh-redirect-bug 
./symlink1
./symlink2
total 0
-rw-r--r--   1 software software       0 Sep  1 15
-rw-r--r--   1 software software       0 Sep  1 15

[software@porta] % /bin/sh zsh-redirect-bug
./symlink1
./symlink2

[software@porta] % /bin/ksh zsh-redirect-bug                
./symlink1
./symlink2

[software@porta] % /bin/bash zsh-redirect-bug 
./symlink1
./symlink2



http://mobile.yahoo.com.au - Yahoo! Messenger for SMS
- Now send & receive IMs on your mobile via SMS



Messages sorted by: Reverse Date, Date, Thread, Author