Environment variables in Solaris

Source: Internet
Author: User
environment variables in Solaris

environment variables are mainly divided into
1 default loading (such as /etc/profile)
2 temporarily modified (such as export path=)

Temporary modification is relatively simple, is to modify the current environment variable value, as the name implies that the effect time is temporary.

Default load is also divided into
1 Global as /etc/profile
2
Current user as ~/.profile

The current user inherits global variables, such as different values of the same variable, whichever is the last set.

Global ( root)
/etc/profile:      
This file sets the environment information for each user of the system, and the file is executed the first time the user logs on.

/etc/bash_profile:
Sets the shell information used for each user, and when the user logs on for the first time, the file executes only once

/ETC/BASHRC: Linux The
executes this file for each user running the bash shell. When the bash shell is opened, the file is read

the current user
~/.bash_ when it is logged on and each time a new shell is opened. Profile:
Each user can use this file to enter shell information that is specific to their own use, and the file executes only once when the user logs on! By default, he sets some environment variables to execute the user's. bashrc file.

~/.BASHRC:
The file contains bash information dedicated to your bash shell, which is read
when you log in and each time you open a new shell.
~/.bash_logout:
Executes the file each time it exits the system (the Bash shell is exited).

~/.profile is a file in the user's home directory where the ENV environment variable settings are executed each time the user logs on.
/etc/profile is a global environment variable setting, as long as the user of the login system will execute the ENV environment variable set
The ~/.KSHRC is executed under the user's home directory, each time the child shell under Ksh is executed, and the ENV environment variable settings are implemented.
The ~/.dtprofile is in the user's home directory, where you set some variable settings for you to enter the CDE, and if the user does not enter the system via CDE, the file will not be generated. Only users who have entered the system with CDE will automatically generate a. dtprofile file, and then you can set the variables inside ...
If the dtsourceprofile variable in this file is set to True, the variable settings in the. profile file under the user's attention path are read, and if there is no such variable or set to False, then the environment variable in profile is not read.

If you want the settings in the newly changed. Profile. KSHRC to work immediately, you can use the following command:
. ~/.profile
. ~/.kshrc

Available/etc/profile files:

Trap "" 2 3
Export LOGNAME PATH
Path=/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/ccs/bin:/usr/sadm/admin/bin:/usr/local/ssl/bin: $PATH;
Export PATH
Manpath=/usr/share/man:/usr/local/man;
Export Manpath
Ld_library_path=/usr/local/lib; E
Xport Ld_library_path

Editor=/usr/bin/vi;
Export EDITOR

Ulimit-n 8192

If ["$TERM" = ""]
then
        if/bin/i386
         then
                 Term=sun-color
        Else
                 Term=sun
        fi
        export TERM
fi
#       Login AND-SU Shells Get/etc/profile Services.
#      -rsh is given IT environment in it. Profile.
Case "$" in
-sh |-ksh |-jsh |-bash)

if [!-F. Hushlogin]
Then
/usr/sbin/quota
# Allow the user to break the Message-of-the-day only.
Trap "Trap ' 2" 2
/bin/cat-s/ETC/MOTD
Trap "" 2

/bin/mail-e
Case $? In
0)
echo "You have new mail."
;;
2)
echo "You have mail."
;;
Esac
Fi
Esac
Umask 022
Trap 2 3

(Above from: http://hi.baidu.com/jiaozhenqing/blog/item/7c3472d94c4bd7ef38012f3f.html)

The following methods are found from the Internet and are not partially attempted:
1. cshrs.

Set path= (/usr/local/bin $ path)

2 # path= $PATH:/usr/local/bin;export PATH

The. Profile file is a summary of the details of the/ETC/SKEL/LOCAL.PROFILE environment variable.

1. If you are using the Solaris default shell. The file name that is produced under the home directory is. Profile.
If it is a bash shell, the file name generated in the home directory is. Bash_profile.

2. The/etc/profile file is a global variable.

3. Profile file is/etc/skel/local.profile. Changes to the new Solaris version.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.