Problem with /etc/profile?

Forum rules
Before you post please read this

Problem with /etc/profile?

Postby unkilbeeg on Tue Aug 09, 2011 7:21 pm

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?
unkilbeeg
Level 1
Level 1
 
Posts: 19
Joined: Tue Apr 27, 2010 5:02 pm

Linux Mint is funded by ads and donations.
 

Re: Problem with /etc/profile?

Postby xenopeek on Wed Aug 10, 2011 2:19 am

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.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14502
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 1 guest