Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


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

su in a script?





su causes the spawning of a subordinate shell, which can't see
the contents of your script.  You can demonstrate like this:

    su someOtherUser
    echo OK - su is finished

You'll see the echo when you terminate someOtherUser's session.



If you really want folks to run as some other user
and they always do the same thing while that other
user's guise, then you can just modify that other
user's startup scripts (e.g.  their .bash_profile)
so you could invent some user named playQuake and
cause playQuake's .bash_profile to always start Quake.

Then you could use the "-" argument to su to force
execution of the login script, thus:

    su - playQuake

Of course, I have no idea what you're really trying
to accomplish, so this might all be dramatic overkill...

-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org