Description of problem: Consider the following buggy code: -- # x=no [ $x = "no" ] || echo yes -bash: [: =: unary operator expected yes -- Similar errors are suprisingly pervasive in rhel5 and 4. Install rpms and run find /etc -type f | xargs grep '\[[[:space:]]*\${[^}]*\}[[:space:]]*=[[:space:]]*\".*\".*]' -C 2 -n --color=yes for a nice list. This is probably a big part of why my console is littered with stderr instead of nice pretty green "OK" symbols during boot. Version-Release number of selected component (if applicable): at least rhel4 and 5. Steps to Reproduce: 1.install, i.e., el4 krb5-server 2 run any init script from this package 3.read output on stderr Actual results: [: =: unary operator expected Expected results: silence Additional info: Adding quotes around the shell var. gives apples<->apples comparison fixing problem. Tested only on CentOS.
oops, here is an improved version of the above script that catches more bugs: find /etc -type f | xargs grep '\[[[:space:]]*\$[^\"]*=[[:space:]]*\".*\".*]' -C 2 -n --color=yes
FYI I have confirmed that replacing, ie [ $foo = "bar" ] with [ "$foo" = "bar" ] in all initscripts makes the (serial console) boot sequence pretty again. Glad to see fixing the bug does not seem to have broken my server in any noticable way :)
The instances which the grep catches (thanks for that) seem to have been fixed for RHEL as part of bug #242500, so I'm moving this to Fedora development, which hasn't had those changes merged, so that I don't forget to get them in for F9. Thanks!