Red Hat Bugzilla – Bug 440652
Wrong Test Syntax With Zsh
Last modified: 2008-04-07 16:34:32 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b5) Gecko/2008040216 Fedora/3.0-0.52.beta5.fc9 Firefox/3.0b5
Description of problem:
On line 21 in /etc/profile.d/colorls.sh, there's a test that reads like that:
[ "`tput colors 2>/dev/null`" == "256" ] && \
I use zsh as my shell and zsh doesn't use the double = test as demonstrated in this example:
mchouque - /etc/profile.d %[ a == b ] && echo true
zsh: = not found
mchouque - /etc/profile.d %[[ a == b ]] && echo true
Ie in the man page, it says [ is like the system version of test which clearly doesn't support == to compare two strings (zsh will only support it if you use the [[ compound command).
So I guess the test should be changed to
[ "`tput colors 2>/dev/null`" = "256" ] && \
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. use zsh as system shell
2. source /etc/profile.d/colorls.sh
3. you get /etc/profile.d/colorls.sh:21: = not found
In brief, this is clearly just a bashism in the colorls.sh script, the POSIX way
is to use "=" instead of "==".
For the sake of us who prefer other shells than bash, please fix colorls.sh. Thanks.
Thanks for report. Sorry for troubles and that bashism. Fixed in
coreutils-6.10-18.fc9. Closing RAWHIDE.