bash vs sh: parameter not set



Ops....
Post #34



I don't understand English very well, try to explain yourself better
"The PATH can be exported from a number of different files" simply means that the export command can occur in a number of different files, and the user therefore, has the choice of where to use the command.

For example, in this debian machine, the export command is used in the file: /etc/profile, as shown in post #35 where it exports the PATH. In your post #36, according to your code output, the PATH is not exported in the
/etc/profile. In that case, if you wish to export the PATH, it can be done in the
~/$USER/.profile file, for example under the following sort of code in that file:
Code:
#-----------start existing code-------------
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi                                                        
#------------------end existing code------------

export PATH

Alternatively, the same code can be included in the ~/$USER/.bashrc instead of the .profile file with the export command run from .bashrc.

It's usually the case that the .bashrc file includes a number of exported variables, for example on this debian machine:
Code:
[~]$ grep export .bashrc
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export XCURSOR_SIZE=48
export BC_ENV_ARGS=$HOME/.bcrc
#LS_COLORS=$LS_COLORS:'di=01;94:' export LS_COL

Another file from which variables can be set, is in the /etc/environment file, but they should NOT be exported from that file because if a variable is set in that file, it is already automatically applied to the whole system and therefore does not need to be exported. The export command is used in shell scripts, and the format in the
/etc/environment file is a separate text configuration, so it would be erroneous to use the export command in that file.
 
Last edited:


Follow Linux.org

Staff online

Members online


Latest posts

Top