Linux 15.028 Themen, 107.048 Beiträge

path variable

ghartl1 / 3 Antworten / Baumansicht Nickles

hallo,

möchte nur wissen warum bei der path variablen 2 unterschiedliche werte rauskommen

echo $PATH
wachbirn:$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/opt/bin:/usr/local/games:/opt/Adobe/Reader8/bin/:
/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/qt/bin:.

echo $PATH als root:
root:# echo $PATH
/usr/local/bin:/usr/bin:/usr/sbin:/bin:/opt/bin:/usr/X11/bin:/usr/local/games:/usr/games:
/opt/Adobe/Reader8/bin/:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/qt/bin:/usr/local/sbin:/usr/sbin:/sbin

okay,das versteh ich ja noch...

aber in /etc/profile hab ich nur das

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/opt/bin:/usr/local/games:/opt/Ad
obe/Reader8/bin/"

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH. Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
fi
fi


wie passt das zusammen...

gruss günter

bei Antwort benachrichtigen
uscos ghartl1 „path variable“
Optionen

naja, den path kann man auch in ~/.bashrc oder ~/.profile (und einige andere) definieren. Steht auch alles in den man files (man -k bla ist dein freund)

bei Antwort benachrichtigen
KarstenW ghartl1 „path variable“
Optionen

"möchte nur wissen warum bei der path variablen 2 unterschiedliche werte rauskommen"

Weil Linux wie Unix ein Mehrbenutzersystem ist ;-).

In /etc/profile wird (zumnidest bei Debian) die systemweite Pfadvariable eingestellt.

cat /etc/profile


# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi

if [ "$PS1" ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi

export PATH

umask 022


und in der /home/$user/bash_profile (zumindest bei Debian) wird die benutzerdefinierte Pfadvariable eingestellt:

cat /home/karsten/.bash_profile


# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/login.defs
#umask 022

# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi




Debian GNU/Linux https://www.debian.org/index.de.html
bei Antwort benachrichtigen
ghartl1 KarstenW „ möchte nur wissen warum bei der path variablen 2 unterschiedliche werte...“
Optionen

okay..danke

bei Antwort benachrichtigen