HOW DOES ONE SET UP A SYSTEMWIDE ALIAS UNDER KSH?

ITEM: RTA000035980



                                                                                
QUESTION:                                                                       
S/W LEVEL:  3.2                       H/W MACH#:520, 320                        
ASKQ QUESTION TEXT:  Customer wanted to set up alias under ksh for all          
users upon login.  Customer wants alias that calls the mail command.            
He wanted to use /etc/profile, but that did not work.                           
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
A:  The problem with using the /etc/profile file is that the                    
    /etc/profile only gets executed once when the user logs on.  An             
    alias must be re-declared each time a new process is begun (i.e. a          
    new window or shell is opened).                                             
                                                                                
    Normally a user has his/her aliases set up in their .kshrc file.            
    This file is executed every time a new korn shell is begun, and            
    therefore the aliases seem to follow the users to all of their              
    windows.  We simply have to setup some sort of system wide kshrc            
    file that is executed along with the users $HOME/.kshrc file.  The          
    environment variable ENV is used to determine what file is executed         
    when the user opens a new shell.                                            
                                                                                
    The following steps will illustrate how to set up a global alias            
    file for your users.                                                        
                                                                                
       1)  su to root                                                           
                                                                                
       2)  Use vi to edit /etc/profile and add the following line               
                                                                                
            export ENV=/etc/sys.kshrc                                           
                                                                               
       3)  Create a new file /etc/sys.kshrc with the following format           
                                                                                
           ------------------------------------------------------               
                                                                  
                                                                  
            < etc...     >                                                      
                                                                                
            # The following will execute the users .kshrc file if               
            # one exists                                                        
                                                                                
            if  -s $HOME/.kshrc                             
            then                                                                
                . $HOME/.kshrc                                                  
            fi                                                                  
           ------------------------------------------------------              
                                                                                
        Note: The following is a key to the symbols used in the above           
        shell script, since not all characters translate in ASKQ                
        correctly.                                                              
                                                                                
               Left Square Bracket                                         
               Right Square Bracket                                        
              $     Dollar sign                                                 
              #     Pound sign                                                  
                                                                                
       4)  Save the file then add execute permission for everyone with          
           the following command.                                               
                                                                                
            chmod +x /etc/sys.kshrc                                             
                                                                               
       5)  The final step is to make sure that none of the users have           
           defined their ENV variable in their $HOME/.profile file.             
           If the users have their ENV variable defined it will                 
           override the system wide definition.  If they do have it             
           defined simply ask them to comment this line out, and                
           assure them that their $HOME/.kshrc files will still be              
           executed.                                                            
                                                                                
     The /etc/sys.kshrc file can now be used by the system administrator        
     to add any global aliases that are deemed necessary simply by              
     editing this one file.                                                     
                                                                                
     If you have any problems implementing this please feel free                
     to reopen this item                                                        
                                                                               
---------- ---------- ---------- --------- ---------- ----------                
                                                                                
                                                                                
This item was created from library item Q646510      CMRWD                      
                                                                                
Additional search words:                                                        
ALIAS CENTER CMRWD DEC93 IX KSH SET SETTING SUPPORT SUPPORTED                   
SYSTEMWIDE UP XXRISC                                                            
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                               


WWQA: ITEM: RTA000035980 ITEM: RTA000035980
Dated: 12/1995 Category: XXRISC
This HTML file was generated 99/06/24~12:43:13
Comments or suggestions? Contact us