Red Hat Bugzilla – Bug 160731
/etc/profile has syntax error when used with korn shell (pdksh)
Last modified: 2014-03-16 22:54:31 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Description of problem:
When logging in using pdksh as the login shell, the following (benign) error
/etc/profile: [: argument expected
Line 17 in /etc/profile:
if [ $EUID = 0 ]; then
While both Bash and PDKSH use /etc/profile at login, only bash provides
an EUID environment variable. The if statement on line 17 should be changed
if [ "$EUID" = "0" ]; then
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.specify the korn shell (pdksh) as login shell
Actual Results: /etc/profile: [: argument expected
Alternatively, you could change this back to the version used in FC3 which
invoked the 'id' command to determine the effective UID of the current
process. Note that the backtick method of invoking commands from shell scripts
has been deprecated for quite some time in favor of $(cmd). For example,
instead of `id -u`, one should use $(id -u) in bourne/korn/bourneagain scripts.
EUID is used becasue id is in /usr/bin. Fixed in CVS, will be in future builds.
If someone (as I usually do) uses usermod(1m) to change the root shell from bash
to ksh, then the PATH will not include the sbin directories on root logins.
You cannot correctly rely on EUID in this case.
# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
added in 2.5.45-1.
*** Bug 161433 has been marked as a duplicate of this bug. ***
*** Bug 171861 has been marked as a duplicate of this bug. ***
*** Bug 171945 has been marked as a duplicate of this bug. ***
*** Bug 173784 has been marked as a duplicate of this bug. ***
*** Bug 176265 has been marked as a duplicate of this bug. ***