[arch-general] root $PATH via "su - -c mc" ??

Joe(theWordy)Philbrook jtwdyp at ttlc.net
Fri Aug 10 18:40:39 EDT 2012


OK so I guess /root/.bash_profile wouldn't be read by a script generated 
login shell that feeds "su - -c mc" to the -e option of a "konsole" command,
since it's not considered an "interactive" login...

Which explains why the conditional PATH command I routinely put in my
.bash_profile scripts (not in .bashrc to prevent it being appended multiple
times):  
 
if [ -d ~/bin ] ; then
    PATH="${PATH}":~/bin
fi
 
doesn't add "/root/bin" to the default path of the resulting "root" mc session
in the resulting konsole window, like it does with a console root login...  
IE:

/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl:/root/bin

But since even a generic user's default system PATH variable includes the "sbin"
directories... IE:

/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl
 
Why would the root mc shell resulting from the scripted "su - -c mc" wind
up with a PATH variable containing only:

/usr/ucb:/bin:/usr/bin:/etc

???

I know I can fix this by defining root's path in root's .bashrc, but I'd
have to give up on conditionally adding ~/bin in .bash_profile as every
subshell would overwrite it with the .bashrc assignment...

Suggestions anyone???

-- 
|  ~^~   ~^~
|  <?>   <?>       Joe (theWordy) Philbrook
|      ^                J(tWdy)P
|    \___/         <<jtwdyp at ttlc.net>>



More information about the arch-general mailing list