🐢
Linux環境変数の初期値確認
環境変数初期値確認とスクリプトによる設定
環境
-
SUSE Linux Enterprise Server 15(WSL)
-
Kernel
~/work # cat /proc/version
Linux version 4.4.0-18362-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) #1049-Microsoft Thu Aug 14 12:01:00 PST 2020
- OS
~/work # cat /etc/os-release
NAME="SLES"
VERSION="15"
VERSION_ID="15"
PRETTY_NAME="SUSE Linux Enterprise Server 15"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15"
-
.bashrc
- プロンプトを見やすい用に設定中(Bashプロンプトのホスト名を非表示にする)
~ # cat /root/.bashrc
export PS1="\[\]\w #\[\] "
環境変数について
- 【参考】環境変数 - ArchWiki
- 環境変数とは1つ、または複数のアプリケーションによって使用されるデータを含んだ名前付きオブジェクト
- 複数のアプリケーションと Linux のプロセスの設定を共有するシンプルな方法
- 適当な環境変数設定ファイル (
/etc/profile
あるいは/etc/bash.bashrc
) に記述することで、特定のユーザの変数PATH
に○○を追加等が可能
- 適当な環境変数設定ファイル (
初期状態
- ①起動時(=output_env_0)
~/work # env
LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.xz=00;31:*.avi=01;35:*.bmp=01;35:*.dl=01;35:*.fli=01;35:*.gif=01;35:*.gl=01;35:*.jpg=01;35:*.jpeg=01;35:*.mkv=01;35:*.mng=01;35:*.mov=01;35:*.mp4=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.svg=01;35:*.tga=01;35:*.tif=01;35:*.webm=01;35:*.webp=01;35:*.wmv=01;35:*.xbm=01;35:*.xcf=01;35:*.xpm=01;35:*.aiff=00;32:*.ape=00;32:*.au=00;32:*.flac=00;32:*.m4a=00;32:*.mid=00;32:*.mp3=00;32:*.mpc=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.wma=00;32:*.wv=00;32:
HOSTTYPE=x86_64
LESSCLOSE=lessclose.sh %s %s
XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
LANG=POSIX
WINDOWMANAGER=xterm
LESS=-M -I -R
HOSTNAME=DESKTOP-M5NE5GB
CSHEDIT=emacs
GPG_TTY=/dev/tty1
LESS_ADVANCED_PREPROCESSOR=no
COLORTERM=1
WSL_DISTRO_NAME=SLES-15
MACHTYPE=x86_64-suse-linux
MINICOM=-c on
OSTYPE=linux
USER=root
PAGER=less
MORE=-sl
PWD=/root/work
HOME=/root
LC_CTYPE=en_US.UTF-8
HOST=DESKTOP-M5NE5GB
NAME=SLES
XNLSPATH=/usr/X11R6/lib/X11/nls
XDG_DATA_DIRS=/usr/share
PROFILEREAD=true
MAIL=/var/spool/mail/root
LESSKEY=/etc/lesskey.bin
SHELL=/bin/bash
TERM=xterm-256color
LS_OPTIONS=-A -N --color=tty -T 0
PYTHONSTARTUP=/etc/pythonstart
SHLVL=1
MANPATH=/usr/share/man:/usr/local/man
LOGNAME=root
XDG_CONFIG_DIRS=/etc/xdg
PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin
PS1=\[\]\w #\[\]
G_BROKEN_FILENAMES=1
HISTSIZE=1000
WSLENV=
CPU=x86_64
LESSOPEN=lessopen.sh %s
_=/usr/bin/env
OLDPWD=/root
~/work # env > output_env_0
- ②ログイン:
# su root
(output_env_1)- 注意点
-
# su [ユーザ名]
では環境変数も元のユーザーのものが引き継がれる
=事故が起きやすい -
# su - [ユーザ名]
では環境変数は変更したユーザーの初期値に設定される
-
- 注意点
~/work # su root
~/work # env
LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.xz=00;31:*.avi=01;35:*.bmp=01;35:*.dl=01;35:*.fli=01;35:*.gif=01;35:*.gl=01;35:*.jpg=01;35:*.jpeg=01;35:*.mkv=01;35:*.mng=01;35:*.mov=01;35:*.mp4=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.svg=01;35:*.tga=01;35:*.tif=01;35:*.webm=01;35:*.webp=01;35:*.wmv=01;35:*.xbm=01;35:*.xcf=01;35:*.xpm=01;35:*.aiff=00;32:*.ape=00;32:*.au=00;32:*.flac=00;32:*.m4a=00;32:*.mid=00;32:*.mp3=00;32:*.mpc=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.wma=00;32:*.wv=00;32:
HOSTTYPE=x86_64
LESSCLOSE=lessclose.sh %s %s
XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
LANG=POSIX
WINDOWMANAGER=xterm
LESS=-M -I -R
HOSTNAME=DESKTOP-M5NE5GB
OLDPWD=/root
CSHEDIT=emacs
GPG_TTY=/dev/tty1
LESS_ADVANCED_PREPROCESSOR=no
COLORTERM=1
WSL_DISTRO_NAME=SLES-15
MACHTYPE=x86_64-suse-linux
MINICOM=-c on
OSTYPE=linux
USER=root
PAGER=less
MORE=-sl
PWD=/root/work
HOME=/root
LC_CTYPE=en_US.UTF-8
HOST=DESKTOP-M5NE5GB
NAME=SLES
XNLSPATH=/usr/X11R6/lib/X11/nls
XDG_DATA_DIRS=/usr/share
PROFILEREAD=true
MAIL=/var/spool/mail/root
LESSKEY=/etc/lesskey.bin
TERM=xterm-256color
SHELL=/bin/bash
LS_OPTIONS=-A -N --color=tty -T 0
PYTHONSTARTUP=/etc/pythonstart
SHLVL=2
MANPATH=/usr/share/man:/usr/local/man
LOGNAME=root
XDG_CONFIG_DIRS=/etc/xdg
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PS1=\[\]\w #\[\]
G_BROKEN_FILENAMES=1
HISTSIZE=1000
WSLENV=
CPU=x86_64
LESSOPEN=lessopen.sh %s
_=/usr/bin/env
~/work # env > output_env_1
- ①と②の違い
- 追加
OLDPWD=/root
- 変更
-
SHLVL=1
- →
SHLVL=2
=シェルの深さが一つ増えた
- →
-
PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin
- →
PATH=/sbin:/bin:/usr/sbin:/usr/bin
=
※消えた/usr/local/sbin
,/root/bin
,/usr/local/bin
ディレクトリには現在ファイル無し
- →
-
- 追加
~/work # diff -u output_env_0 output_env_1
--- output_env_0 2020-10-21 20:07:40.929494700 +0900
+++ output_env_1 2020-10-21 20:07:54.002594000 +0900
@@ -6,6 +6,7 @@
WINDOWMANAGER=xterm
LESS=-M -I -R
HOSTNAME=DESKTOP-M5NE5GB
+OLDPWD=/root
CSHEDIT=emacs
GPG_TTY=/dev/tty1
LESS_ADVANCED_PREPROCESSOR=no
@@ -27,16 +28,16 @@
PROFILEREAD=true
MAIL=/var/spool/mail/root
LESSKEY=/etc/lesskey.bin
-SHELL=/bin/bash
TERM=xterm-256color
+SHELL=/bin/bash
LS_OPTIONS=-A -N --color=tty -T 0
PYTHONSTARTUP=/etc/pythonstart
-SHLVL=1
+SHLVL=2
MANPATH=/usr/share/man:/usr/local/man
LOGNAME=root
XDG_CONFIG_DIRS=/etc/xdg
-PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin
-PS1=\[\]\w #\[\]
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+PS1=\[\]\w #\[\]
G_BROKEN_FILENAMES=1
HISTSIZE=1000
WSLENV=
- ③ログイン:
# su - root
(output_env_2)
~/work # su - root
~ # cd work/
~/work # env
LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.xz=00;31:*.avi=01;35:*.bmp=01;35:*.dl=01;35:*.fli=01;35:*.gif=01;35:*.gl=01;35:*.jpg=01;35:*.jpeg=01;35:*.mkv=01;35:*.mng=01;35:*.mov=01;35:*.mp4=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.svg=01;35:*.tga=01;35:*.tif=01;35:*.webm=01;35:*.webp=01;35:*.wmv=01;35:*.xbm=01;35:*.xcf=01;35:*.xpm=01;35:*.aiff=00;32:*.ape=00;32:*.au=00;32:*.flac=00;32:*.m4a=00;32:*.mid=00;32:*.mp3=00;32:*.mpc=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.wma=00;32:*.wv=00;32:
HOSTTYPE=x86_64
LESSCLOSE=lessclose.sh %s %s
XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
LANG=POSIX
WINDOWMANAGER=xterm
LESS=-M -I -R
HOSTNAME=DESKTOP-M5NE5GB
CSHEDIT=emacs
GPG_TTY=/dev/tty1
LESS_ADVANCED_PREPROCESSOR=no
COLORTERM=1
MACHTYPE=x86_64-suse-linux
MINICOM=-c on
OSTYPE=linux
USER=root
PAGER=less
MORE=-sl
PWD=/root/work
HOME=/root
LC_CTYPE=en_US.UTF-8
HOST=DESKTOP-M5NE5GB
XNLSPATH=/usr/X11R6/lib/X11/nls
XDG_DATA_DIRS=/usr/share
PROFILEREAD=true
MAIL=/var/spool/mail/root
LESSKEY=/etc/lesskey.bin
SHELL=/bin/bash
TERM=xterm-256color
LS_OPTIONS=-A -N --color=tty -T 0
PYTHONSTARTUP=/etc/pythonstart
SHLVL=1
MANPATH=/usr/share/man:/usr/local/man
LOGNAME=root
XDG_CONFIG_DIRS=/etc/xdg
PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin
PS1=\[\]\w #\[\]
G_BROKEN_FILENAMES=1
HISTSIZE=1000
CPU=x86_64
LESSOPEN=lessopen.sh %s
OLDPWD=/root
_=/usr/bin/env
~/work # env > output_env_2
- ①と③の違い
- 削除
WSL_DISTRO_NAME=SLES-15
NAME=SLES
WSLENV=
- 追加
OLDPWD=/root
- 削除
~/work # diff -u output_env_0 output_env_2
--- output_env_0 2020-10-21 20:07:40.929494700 +0900
+++ output_env_2 2020-10-21 20:20:55.632660100 +0900
@@ -10,7 +10,6 @@
GPG_TTY=/dev/tty1
LESS_ADVANCED_PREPROCESSOR=no
COLORTERM=1
-WSL_DISTRO_NAME=SLES-15
MACHTYPE=x86_64-suse-linux
MINICOM=-c on
OSTYPE=linux
@@ -21,7 +20,6 @@
HOME=/root
LC_CTYPE=en_US.UTF-8
HOST=DESKTOP-M5NE5GB
-NAME=SLES
XNLSPATH=/usr/X11R6/lib/X11/nls
XDG_DATA_DIRS=/usr/share
PROFILEREAD=true
@@ -36,10 +34,10 @@
LOGNAME=root
XDG_CONFIG_DIRS=/etc/xdg
PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin
-PS1=\[\]\w #\[\]
+PS1=\[\]\w #\[\]
G_BROKEN_FILENAMES=1
HISTSIZE=1000
-WSLENV=
CPU=x86_64
LESSOPEN=lessopen.sh %s
+OLDPWD=/root
_=/usr/bin/env
- ②と③違い
- 削除
WSL_DISTRO_NAME=SLES-15
NAME=SLES
WSLENV=
- 変更
-
SHLVL
とPATH
が起動時の状態に戻った
-
- 削除
~/work # diff -u output_env_1 output_env_2
--- output_env_1 2020-10-21 20:07:54.002594000 +0900
+++ output_env_2 2020-10-21 20:20:55.632660100 +0900
@@ -6,12 +6,10 @@
WINDOWMANAGER=xterm
LESS=-M -I -R
HOSTNAME=DESKTOP-M5NE5GB
-OLDPWD=/root
CSHEDIT=emacs
GPG_TTY=/dev/tty1
LESS_ADVANCED_PREPROCESSOR=no
COLORTERM=1
-WSL_DISTRO_NAME=SLES-15
MACHTYPE=x86_64-suse-linux
MINICOM=-c on
OSTYPE=linux
@@ -22,25 +20,24 @@
HOME=/root
LC_CTYPE=en_US.UTF-8
HOST=DESKTOP-M5NE5GB
-NAME=SLES
XNLSPATH=/usr/X11R6/lib/X11/nls
XDG_DATA_DIRS=/usr/share
PROFILEREAD=true
MAIL=/var/spool/mail/root
LESSKEY=/etc/lesskey.bin
-TERM=xterm-256color
SHELL=/bin/bash
+TERM=xterm-256color
LS_OPTIONS=-A -N --color=tty -T 0
PYTHONSTARTUP=/etc/pythonstart
-SHLVL=2
+SHLVL=1
MANPATH=/usr/share/man:/usr/local/man
LOGNAME=root
XDG_CONFIG_DIRS=/etc/xdg
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
+PATH=/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin
PS1=\[\]\w #\[\]
G_BROKEN_FILENAMES=1
HISTSIZE=1000
-WSLENV=
CPU=x86_64
LESSOPEN=lessopen.sh %s
+OLDPWD=/root
_=/usr/bin/env
-
/etc/profile
抜粋(※備考記載)
#
# Make path more comfortable
#
# save current path setting, we might want to restore it
ORIG_PATH=$PATH
#
if test -z "$PROFILEREAD" ; then
PATH=/usr/local/bin:/usr/bin:/bin
if test "$HOME" != "/" ; then
for dir in $HOME/bin/$CPU $HOME/bin ; do
test -d $dir && PATH=$dir:$PATH
done
fi
if test "$UID" = 0 ; then
test -d /opt/kde3/sbin && PATH=/opt/kde3/sbin:$PATH
PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
fi
for dir in /usr/X11/bin \
/usr/X11R6/bin \
/var/lib/dosemu \
/usr/games \
/opt/bin \
/opt/kde3/bin \
/opt/kde2/bin \
/opt/kde/bin \
/usr/openwin/bin \
/opt/cross/bin
do
test -d $dir && PATH=$PATH:$dir
done
unset dir
export PATH
fi
スクリプトで環境変数をカレントシェルに読み込ませる際の注意点
-
bashrc_test.sh
-
TEST_ENV
という環境変数を設定したいとする
-
~/work # cat bashrc_test.sh
#!/bin/bash
export TEST_ENV=test
- bashコマンド(または、shコマンド)
- 子プロセスを作成しての実行のため、カレントシェルに読み込まれない
~/work # bash bashrc_test.sh
~/work # echo $TEST_ENV
~/work #
-
.
での実行(または、sourceコマンド)- カレントシェルでの実行(読み込み)のため、反映される
~/work # . bashrc_test.sh
~/work # echo $TEST_ENV
test
備考
/etc/profile
~/work # cat /etc/profile
# /etc/profile for SUSE Linux
#
# PLEASE DO NOT CHANGE /etc/profile. There are chances that your changes
# will be lost during system upgrades. Instead use /etc/profile.local for
# your local settings, favourite global aliases, VISUAL and EDITOR
# variables, etc ...
#
# Check which shell is reading this file
#
norc=false
restricted=false
if test -f /proc/mounts ; then
if ! is=$(readlink /proc/$$/exe 2>/dev/null) ; then
case "$0" in
*pcksh) is=ksh ;;
*) is=sh ;;
esac
fi
case "$is" in
*/bash) is=bash
while read -r -d $'\0' a ; do
case "$a" in
--norc)
readonly norc=true ;;
--restricted)
readonly restricted=true ;;
esac
done < /proc/$$/cmdline
case "$0" in
sh|-sh|*/sh)
is=sh ;;
esac ;;
*/ash) is=ash ;;
*/dash) is=ash ;;
*/ksh) is=ksh ;;
*/ksh93) is=ksh ;;
*/pdksh) is=ksh ;;
*/mksh) is=ksh ;;
*/lksh) is=ksh ;;
*/*pcksh) is=ksh ;;
*/zsh) is=zsh ;;
*/*) is=sh ;;
esac
#
# `r' in $- occurs *after* system files are parsed
#
for a in $SHELL ; do
case "$a" in
*/r*sh)
readonly restricted=true ;;
-r*|-[!-]r*|-[!-][!-]r*)
readonly restricted=true ;;
--restricted)
readonly restricted=true ;;
esac
done
unset a
else
is=sh
fi
#
# Call common progams from /bin or /usr/bin only
#
path ()
{
command -p ${1+"$@"}
}
#
# Initialize terminal
#
tty=`path tty 2> /dev/null`
test $? -ne 0 && tty=""
if test -O "$tty" -a -n "$PS1"; then
test -z "${TERM}" && { TERM=linux; export TERM; }
test "${TERM}" = "unknown" && { TERM=linux; export TERM; }
test "${TERM}" = "ibm327x" && { TERM=dumb; export TERM; }
case "$TERM" in
screen.*)
test -e /usr/share/terminfo/s/${TERM} || { TERM=screen; export TERM; }
esac
# Do not change settings on local line if connected to remote
if test -z "$SSH_TTY" -a "${TERM}" != "dumb" ; then
path stty sane cr0 pass8 dec
path tset -I -Q
fi
fi
unset TERMCAP
#
# Time until a complete key sequence must have arrived
#
#ESCDELAY=2000
#export ESCDELAY
#
# The user file-creation mask
#
# The global umask value is stored in /etc/login.defs and
# will be set by pam_umask.so (see "man pam_umask").
#umask 022
#
# Setup for gzip and (t)csh users
#
if test -z "$PROFILEREAD" ; then
# GZIP=-9
# export GZIP
CSHEDIT=emacs
export CSHEDIT
fi
#
# ksh/ash sometimes do not know
#
test -z "$UID" && readonly UID=`path id -ur 2> /dev/null`
test -z "$EUID" && readonly EUID=`path id -u 2> /dev/null`
test -z "$USER" && USER=`path id -un 2> /dev/null`
test -z "$MAIL" && MAIL=/var/spool/mail/$USER
if test -x /bin/uname ; then
test -z "$HOST" && HOST=`/bin/uname -n`
test "$HOST" = "localhost" && HOST=`/bin/uname -n`
test -z "$CPU" && CPU=`/bin/uname -m`
fi
# Remark: /proc/sys/kernel/domainname and the program domainname
# its self will provide the NIS/YP domainname, see domainname(8).
if test -s /etc/HOSTNAME ; then
test -z "$HOSTNAME" && HOSTNAME=`cat /etc/HOSTNAME`
else
test -z "$HOSTNAME" && HOSTNAME=$HOST
fi
test -z "$LOGNAME" && LOGNAME=$USER
case "$CPU" in
i?86) HOSTTYPE=i386 ;;
*) HOSTTYPE=${CPU} ;;
esac
OSTYPE=linux
MACHTYPE=${CPU}-suse-${OSTYPE}
# Do NOT export UID, EUID, USER, and LOGNAME
export MAIL HOST CPU HOSTNAME HOSTTYPE OSTYPE MACHTYPE
#
# You may use /etc/initscript, /etc/profile.local or the
# ulimit package instead to set up ulimits and your PATH.
#
# if test "$is" != "ash" -a ! -r /etc/initscript; then
# ulimit -Sc 0 # don't create core files
# ulimit -Sd $(ulimit -Hd)
# ulimit -Ss $(ulimit -Hs)
# ulimit -Sm $(ulimit -Hm)
# fi
#
# Make path more comfortable
#
# save current path setting, we might want to restore it
ORIG_PATH=$PATH
#
if test -z "$PROFILEREAD" ; then
PATH=/usr/local/bin:/usr/bin:/bin
if test "$HOME" != "/" ; then
for dir in $HOME/bin/$CPU $HOME/bin ; do
test -d $dir && PATH=$dir:$PATH
done
fi
if test "$UID" = 0 ; then
test -d /opt/kde3/sbin && PATH=/opt/kde3/sbin:$PATH
PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
fi
for dir in /usr/X11/bin \
/usr/X11R6/bin \
/var/lib/dosemu \
/usr/games \
/opt/bin \
/opt/kde3/bin \
/opt/kde2/bin \
/opt/kde/bin \
/usr/openwin/bin \
/opt/cross/bin
do
test -d $dir && PATH=$PATH:$dir
done
unset dir
export PATH
fi
#
# Most bourn shell clones knows about this
#
if test -z "$PROFILEREAD" ; then
HISTSIZE=1000
export HISTSIZE
fi
#
# Set some environment variables for TeX/LaTeX (Not used due luatex)
#
#if test -n "$TEXINPUTS" ; then
# TEXINPUTS=":$TEXINPUTS:$HOME/.TeX:/usr/share/doc/.TeX:/usr/doc/.TeX"
#else
# TEXINPUTS=":$HOME/.TeX:/usr/share/doc/.TeX:/usr/doc/.TeX"
#fi
#export TEXINPUTS
#
# Configure the default pager on SUSE Linux
#
if test -z "$LESS" -a -x /usr/bin/less ; then
LESS="-M -I -R"
LESSOPEN="lessopen.sh %s"
LESSCLOSE="lessclose.sh %s %s"
LESS_ADVANCED_PREPROCESSOR="no"
if test -s /etc/lesskey.bin ; then
LESSKEY=/etc/lesskey.bin
fi
PAGER=less
MORE=-sl
export LESSOPEN LESSCLOSE LESS LESSKEY PAGER LESS_ADVANCED_PREPROCESSOR MORE
fi
#
# Minicom
#
if test -z "$PROFILEREAD" ; then
MINICOM="-c on"
export MINICOM
fi
#
# Current manpath
#
if test -z "$PROFILEREAD" ; then
tmp="$MANPATH"
unset MANPATH
if test -n "$tmp" ; then
MANPATH="${tmp}:`test -x /usr/bin/manpath && /usr/bin/manpath -q`"
else
MANPATH="`test -x /usr/bin/manpath && /usr/bin/manpath -q`"
fi
unset tmp
export MANPATH
fi
#
# Some applications do not handle the XAPPLRESDIR environment properly,
# when it contains more than one directory. More than one directory only
# makes sense if you have a client with /usr mounted via nfs and you want
# to configure applications machine dependent. Uncomment the lines below
# if you want this.
#
#XAPPLRESDIR="$XAPPLRESDIR:/var/X11R6/app-defaults:/usr/X11R6/lib/X11/app-defaults"
#export XAPPLRESDIR
#
# These settings are recommended for old motif applications
#
if test -z "$PROFILEREAD" ; then
if [ -r /usr/share/X11/XKeysymDB ]; then
export XKEYSYMDB=/usr/share/X11/XKeysymDB
else
export XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
fi
if [ -d /usr/share/X11/nls ]; then
export XNLSPATH=/usr/share/X11/nls
else
export XNLSPATH=/usr/X11R6/lib/X11/nls
fi
#
# Midnight Commander needs this to run in color mode
#
COLORTERM=1
export COLORTERM
fi
#
# For RCS
#
#VERSION_CONTROL=numbered
#export VERSION_CONTROL
#
# Source profile.d files and UTF8 settings
#
# But do not source this if PROFILEREAD is already set to avoid
# overriding locale variables already present in the environment
#
if test -z "$PROFILEREAD" ; then
test -r /etc/profile.d/sh.ssh && . /etc/profile.d/sh.ssh
fi
#
# Source profile extensions for certain packages, the super
# may disable some of them by setting the sticky bit.
#
if test -d /etc/profile.d -a -z "$PROFILEREAD" ; then
for s in /etc/profile.d/*.sh ; do
test -r $s -a ! -k $s && . $s
done
unset s
fi
if test "$is" != "ash" ; then
#
# And now let's see if there is a local profile
# (for options defined by your sysadmin, not SUSE Linux)
#
test -s /etc/profile.local && . /etc/profile.local
fi
#
# Avoid overwriting user settings if called twice
#
if test -z "$PROFILEREAD" ; then
readonly PROFILEREAD=true
export PROFILEREAD
fi
#
# Standard ssh command does not do an login, therefore
# /etc/profile will be sourced by /etc/bash.bashrc
#
if test -z "$_SOURCED_FOR_SSH" -a "$norc" != true ; then
#
# System BASH specials, maybe also good for other shells
# Note that ksh always reads /etc/ksh.kshrc
#
if test "$is" != ksh -a "$is" != zsh ; then
_is_save=$is
test -r /etc/bash.bashrc && . /etc/bash.bashrc
is=$_is_save
unset _is_save
fi
if test "$restricted" = true ; then
readonly _HOMEBASHRC=true
fi
if test "$is" = "bash" -a -z "$_HOMEBASHRC" ; then
# loop detection
readonly _HOMEBASHRC=true
test -r $HOME/.bashrc && . $HOME/.bashrc
fi
#
# KSH specials
#
if test "$is" = "ksh" -a -r /etc/ksh.kshrc ; then
if test "$restricted" = true ; then
readonly _HOMEKSHRC=true
fi
if test ! /etc/bash.bashrc -ef /etc/ksh.kshrc ; then
test -r /etc/bash.bashrc && . /etc/bash.bashrc
fi
if test -n "$ENV" -a "$ENV" != "\$HOME/.kshrc" -a "$ENV" != "$HOME/.kshrc" -a -z "$_HOMEKSHRC" ; then
# loop detection
readonly _HOMEKSHRC=true
test -r $HOME/.kshrc && . $HOME/.kshrc
fi
fi
fi
if test "$restricted" = true ; then
PATH=/usr/lib/restricted/bin
export PATH
fi
#
# An X session
#
case "$-" in
*i*)
if test "$TERM" = "xterm" -a -O "$tty" -a -z "${SSH_TTY}" ; then
echo "Directory: $PWD"
# Last but not least
date
fi
esac
unset ORIG_PATH
unset is
#
# End of /etc/profile
#
Discussion