Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Using Your HP Workstation > Chapter 16 Using Your Shell

Using Login Scripts to Set the System Environment

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

During the login process, HP-UX prompts you for your user name and password (if applicable) before displaying a shell prompt. HP-UX also notes which shell you have selected to run, starts your shell process, and sets up your environment referring to login scripts. A login script is a file that lets you customize your environment.

A login script contains commands that let you define your system environment. When you log in, default values are assigned to environment variables. Login scripts provide an automatic way to change the value of these variables every time you begin a session.

Two types of login scripts are used:

  • A system script for all users of a particular shell on your system or HP-UX cluster.

  • Local login scripts in your own home directory.

Typically, a system administrator maintains the system login scripts. These scripts set up a default environment for everyone on that system. The POSIX and Bourne Shells use a system login script named /etc/profile.

Once your account is set up, you maintain the local login scripts in your home directory. The local scripts allow you to set up an environment specific to your needs. The Bourne Shell looks for one script: .profile. The POSIX Shell uses two login scripts: .profile and the one referred to by the ENV variable.

Default versions of the login scripts are placed in your home directory when your account is set up. Default versions are also in the /etc directory. For reference, the default .profile script for the POSIX Shell is /etc/skel/.profile.

Why Use Login Scripts?

Login scripts provide a convenient way to set up the shell environment to suit individual needs. For example, the script can change the value of the search path used to find commands, change the shell prompt, set the terminal type, or simply cause the shell to greet you with a friendly message of your choosing.

Customizing your login script is not required, and the login script your system administrator provides should set up the most critical shell parameters.

A Summary of Login Scripts

The following table summarizes the login scripts for each shell. All the scripts run when you first log in. For more information on the POSIX, C, Key, and Bourne Shells, see the Shells: User's Guide.

Table 16-3 Shells and Their Login Scripts

Shell System Login Script Local Login Script
POSIX /etc/profile$HOME/.profile
C /etc/csh.login

$HOME/.cshrc $HOME/.login

Key /etc/profile

$HOME/.profile $HOME/.keyshrc $HOME/.softkeys

Bourne (obsolete)

/etc/profile$HOME/.profile

 

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© © 1983-1995 Hewlett-Packard Development Company, L.P.