EXPORT variable in. profile

Source: Internet
Author: User
I encountered a problem when setting up the Tuxedo environment yesterday, involving variable writing in different shell environments. Problem Background: The OS version is SunOSe2900i-t5.9Generic_122300-12sun4usparcSUNW, after the Netra-T12 creates a user, add the environment variable to. profile: # forTuxedoexportTUX_HOMEoptapptux;

I encountered a problem when setting up the Tuxedo environment yesterday, involving variable writing in different shell environments. Problem Background: The OS version is SunOS e2900i-t 5.9 Generic_122300-12 sun4u iSCSI SUNW, Netra-T12 after creating the user,. add the environment variable in profile: # for Tuxedo export TUX_HOME =/opt/app/tux;

I encountered a problem when setting up the Tuxedo environment yesterday, involving variable writing in different shell environments.

Problem background:

Operating system version is SunOS e2900i-t 5.9 Generic_122300-12 sun4u iSCSI SUNW, Netra-T12

After creating a user, add the environment variable to. profile:

# For Tuxedo
Export TUX_HOME =/opt/app/tux;

...

When you log on again, the following message is displayed:

-Sh export TUX_HOME =/opt/app/tux: is not an identifier

This error occurs.

Some posts say:

1. Modify "/bin/sh" in profile to "/bin/ksh". The attempt fails.

2. export the export TUX_HOME =/opt/app/tux in two rows:

TUX_HOME =/opt/app/tux;

Export TUX_HOME;

This is normal.

Problem Solving:

Since the methods in above 2 can be executed, it may be because different shell environments have different syntax requirements for exporting environment variables.

1. by comparing different shell statements on export environment variables, we found that export TUX_HOME =/opt/app/tux is normal when bash is used, indicating that it is in the format required by bash.

2. Check the local user's default shell: You can query the/etc/passwd file.

Tux: x: 100059: 1:/userhome/tux:/bin/sh

Sh is used by default and changed to bash,

3. Use the usermod-s/bin/bash tux command to modify the default shell.

Log On again to solve the problem.

Knowledge Point 1:
Description of the parameter useradd/usermod:-c comment specifies an annotation description.
-D directory specifies the user's main directory. If this directory does not exist, you can use the-m option to create a main directory.
-G User Group specifies the user group to which the user belongs.
-G user group, which specifies the additional group to which the user belongs.
The-s Shell file specifies the user's logon Shell.
-U user number specifies the user number of a user. If the-o option is available at the same time, the user ID of another user can be used again.

Knowledge Point 2:
When using bash, it is often seen that the user file. bash_profile is used, but the. profile is used here.
"When logging on to Linux, first start the/etc/profile file, and then start ~ /. Bash_profile ,~ /. Bash_login or ~ /. One of the profile files is executed in the following sequence :~ /. Bash_profile ,~ /. Bash_login ,~ /. Profile"

So here I use. profile.

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.