.profile中EXPORT变量的问题
昨天搭建Tuxedo环境时碰到一个问题,涉及到不同shell环境下变量的写法。 问题背景 : 操作系统版本是SunOS e2900i-t 5.9 Generic_122300-12 sun4u sparc SUNW,Netra-T12 创建用户后,向.profile中添加环境变量: #for Tuxedo export TUX_HOME=/opt/app/tux;
昨天搭建Tuxedo环境时碰到一个问题,涉及到不同shell环境下变量的写法。
问题背景:
操作系统版本是SunOS e2900i-t 5.9 Generic_122300-12 sun4u sparc SUNW,Netra-T12
创建用户后,向.profile中添加环境变量:
#for Tuxedo
export TUX_HOME=/opt/app/tux;
...
重登陆时就报:
-sh export TUX_HOME=/opt/app/tux: is not an identifier
这样的错误。
有的帖子说:
1. .profile中"/bin/sh"修改为"/bin/ksh"即可,尝试后失败。
2. 将export TUX_HOME=/opt/app/tux;分为两行导出,即:
TUX_HOME=/opt/app/tux;
export TUX_HOME;
这样可以正常。
问题解决:
既然上述2中的方法可以执行,说明可能还是因为不同的shell环境对于导出环境变量的语法要求不同。
1. 通过比对不同shell对导出环境变量的写法,发现export TUX_HOME=/opt/app/tux;当使用了bash的时候就正常,说明他是bash要求的格式。
2. 检查本机用户默认的shell:可以查询/etc/passwd文件。
tux:x:100059:1::/userhome/tux:/bin/sh
发现默认使用的是sh,将其改为bash,
3. 使用usermod -s /bin/bash tux命令,完成默认shell的修改。
再次登录,问题解决。
知识点1:
useradd/usermod的参数含义:-c comment 指定一段注释性描述。
-d 目录 指定用户主目录,如果此目录不存在,则同时使用-m选项,可以创建主目录。
-g 用户组 指定用户所属的用户组。
-G 用户组,用户组 指定用户所属的附加组。
-s Shell文件 指定用户的登录Shell。
-u 用户号 指定用户的用户号,如果同时有-o选项,则可以重复使用其他用户的标识号。
知识点2:
使用bash时通常看需要使用的是.bash_profile这个用户文件,但这里用的是.profile。
"在刚登录Linux时,首先启动 /etc/profile 文件,然后再启动用户目录下的 ~/.bash_profile、 ~/.bash_login或 ~/.profile文件中的其中一个,执行的顺序为:~/.bash_profile、 ~/.bash_login、 ~/.profile"
因此这里我用的是.profile也可以。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Python is widely used in a wide range of fields with its simple and easy-to-read syntax. It is crucial to master the basic structure of Python syntax, both to improve programming efficiency and to gain a deep understanding of how the code works. To this end, this article provides a comprehensive mind map detailing various aspects of Python syntax. Variables and Data Types Variables are containers used to store data in Python. The mind map shows common Python data types, including integers, floating point numbers, strings, Boolean values, and lists. Each data type has its own characteristics and operation methods. Operators Operators are used to perform various operations on data types. The mind map covers the different operator types in Python, such as arithmetic operators, ratio

Using Ajax to obtain variables from PHP methods is a common scenario in web development. Through Ajax, the page can be dynamically obtained without refreshing the data. In this article, we will introduce how to use Ajax to get variables from PHP methods, and provide specific code examples. First, we need to write a PHP file to handle the Ajax request and return the required variables. Here is sample code for a simple PHP file getData.php:

Players can collect different materials to build buildings when playing in the Mistlock Kingdom. Many players want to know whether to build buildings in the wild. Buildings cannot be built in the wild in the Mistlock Kingdom. They must be within the scope of the altar. . Can buildings be built in the wild in Mistlock Kingdom? Answer: No. 1. Buildings cannot be built in the wild areas of the Mist Lock Kingdom. 2. The building must be built within the scope of the altar. 3. Players can place the Spirit Fire Altar by themselves, but once they leave the range, they will not be able to construct buildings. 4. We can also directly dig a hole in the mountain as our home, so we don’t need to consume building materials. 5. There is a comfort mechanism in the buildings built by players themselves, that is to say, the better the interior, the higher the comfort. 6. High comfort will bring attribute bonuses to players, such as

To solve the problem that jQuery.val() cannot be used, specific code examples are required. For front-end developers, using jQuery is one of the common operations. Among them, using the .val() method to get or set the value of a form element is a very common operation. However, in some specific cases, the problem of not being able to use the .val() method may arise. This article will introduce some common situations and solutions, and provide specific code examples. Problem Description When using jQuery to develop front-end pages, sometimes you will encounter

Instance variables in Java refer to variables defined in the class, not in the method or constructor. Instance variables are also called member variables. Each instance of a class has its own copy of the instance variable. Instance variables are initialized during object creation, and their state is saved and maintained throughout the object's lifetime. Instance variable definitions are usually placed at the top of the class and can be declared with any access modifier, which can be public, private, protected, or the default access modifier. It depends on what we want this to be

Detailed explanation and code examples of const in C In C language, the const keyword is used to define constants, which means that the value of the variable cannot be modified during program execution. The const keyword can be used to modify variables, function parameters, and function return values. This article will provide a detailed analysis of the use of the const keyword in C language and provide specific code examples. const modified variable When const is used to modify a variable, it means that the variable is a read-only variable and cannot be modified once it is assigned a value. For example: constint

Detailed explanation of variable scope in Golang functions In Golang, the scope of a variable refers to the accessible range of the variable. Understanding variable scope is important for code readability and maintainability. In this article, we will take a deep dive into variable scope in Golang functions and provide concrete code examples. In Golang, the scope of variables can be divided into global scope and local scope. The global scope refers to variables declared outside all functions, that is, variables defined outside the function. These variables can be

jQuery is a JavaScript library widely used in web development. It provides many simple and convenient methods to operate web page elements and handle events. In actual development, we often encounter situations where we need to determine whether a variable is empty. This article will introduce several common methods of using jQuery to determine whether a variable is empty, and attach specific code examples. Method 1: Use the if statement to determine varstr="";if(str){co
