[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash Script Issues



Hi
You may try :
su -m -c 'echo User: $(whoami)' USERNAME



-- 
lubo
http://www.linuxconfig.org/

On Mon, Sep 15, 2008 at 1:00 PM, Andrei Popescu
<andreimpopescu@gmail.com> wrote:
> On Sun,14.Sep.08, 19:28:20, Telly Williams wrote:
>
> [...]
>
>>       echo "Still more..."
>>       su -c /home/different/etc.sh <different_user>
>
> [...]
>
>>       When I excute the script, the first two above will execute no problem.
>> But when it gets to the third, where it changes to the <different_user>, the script
>> goes to a shell prompt (<different_user@localhost>) instead of executing the script
>> as the said different_user.  If I type "exit", then the fourth line of the script
>> above gets executed.  Why is that?  I've looked at google and the Debian User archives,
>> but can't seem to find why my script doesn't automatically execute as the said user.  Thanks.
>
> Does it work if you run it directly?
>
> Regards,
> Andrei
> --
> If you can't explain it simply, you don't understand it well enough.
> (Albert Einstein)
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkjNz9oACgkQqJyztHCFm9n1dACeLYIiYROUSbtItTpUhiJIHHKn
> IQIAn0oULY2/r7y8SC1NRfawTMSdD5/i
> =LNHc
> -----END PGP SIGNATURE-----
>
>


Reply to: