Page 1 of 1

Problem with /etc/profile?

Posted: Tue Aug 09, 2011 7:21 pm
by unkilbeeg
I'm not sure if this is the right place for this, but it seemed at least sort of appropriate.

I just installed LMDE on a workstation, and I've managed to get it updated to current. As part of my configuration routine, I went to another workstation so I could SSH in and do some copy and paste on setting up the new machine.

I noticed that each time I logged in remotely, the following message showed up:

Code: Select all

-bash: id: command not found
-bash: [: : integer expression expected
After lots of digging around I noticed that /etc/profile begins like this:

Code: Select all

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH
The "id" command is issued before the PATH is set, so that seems to fail. I replaced that first line with

Code: Select all

if [ "`/usr/bin/id -u`" -eq 0 ]; then
and the problem seems to have gone away.

Has anyone else seen this?

Re: Problem with /etc/profile?

Posted: Wed Aug 10, 2011 2:19 am
by xenopeek
I haven't used SSH, so no comment on the error. But the /etc/profile on my setup has the same code.

BTW you should really not login as root over SSH :D This id -u check is to see if you are logged in as root.