![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Some Info. | ad4m88 | UNIX for Dummies Questions & Answers | 8 | 03-29-2008 07:01 PM |
| Need Info | msgobinathan | Shell Programming and Scripting | 1 | 11-03-2007 05:17 PM |
| cpu info | vijayca | HP-UX | 1 | 08-27-2007 08:51 AM |
| How get more LUN info | itsupplies | Red Hat | 0 | 10-26-2006 04:22 AM |
| exe info | sumsin | High Level Programming | 6 | 11-17-2005 05:15 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
SU info
from the man page of su:
EXAMPLES Example 1: Becoming User bin While Retaining Your Previously Exported Environment To become user bin while retaining your previously exported environment, execute: example% su bin Example 2: Becoming User bin and Changing to bin's Login Environment To become user bin but change the environment to what would be expected if bin had originally logged in, execute: example% su - bin Found the info for my orig ques "what's the diff btwn su and su - when switching to root?" I just don't understand it. Can anyone explain with an example of when to use su or su - when switching to root? I have always just done "su" and I always see evryone else using "su -" when switching to root. ?? |
|
|||||
|
Quote:
You will have subshell having all the previous environment. When you do su - userid .., you will lose the current shell. it is equivalent to rlogin command. You will lose current shell environement. See the following example. $ export var1="hello" $ echo $var1 hello $ su user1 user1's Password: $ echo $var1 hello ------------------> see var1 is retained to the new sub shell. $ export var2="world" $ su - user1 user1's Password: $echo $var2 $ ------------------> see var2 is NOT retained to the new shell. Last edited by bhargav; 03-13-2005 at 02:22 AM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|