Running a Script- and debugging.

Rick Stevens ricks at nerd.com
Thu Sep 24 23:07:57 UTC 2009


Nifty Fedora Mitch wrote:
> On Wed, Sep 23, 2009 at 09:19:26AM -0400, Jim wrote:
> ....
>>> Also 'odd' things can happen if '.' and strange places
>>> are in your PATH.   Are you running it as root via "su",
>>> as root via "su -", as root via "sudo" or as yourself.
> ....
>>>    
>> Mitch you DID IT !!  su - instead of su
> 
> Glad to hear it..
> 
> OK gang out there.
> 
> What portable tricks out there might be included in a script
> to test for a user that typed "su" when "su -" is
> required.   An initial version would simply present 
> a hint but not exit.

Simply "echo $USER".  If it comes back as "root", then they did "su -".
If it comes back as something other than root, they just did "su".
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer                      ricks at nerd.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-      To err is human, to forgive, beyond the scope of the OS       -
----------------------------------------------------------------------




More information about the fedora-list mailing list