Operating System - HP-UX
1753734 Members
4566 Online
108799 Solutions
New Discussion

Re: Adding directories to PATH in HP-UX with csh

 
bruce1946
Occasional Contributor

Adding Directories to PATH in HP-UNIX with csh

HI Guys,
I am truing to add some directories to the productive HP-UX (like /usr/sbin)
the problem is that i tried some methods like (export) and setenv but i failed.
I add some logs output of the commands to provide you with more info .
the user which I am trying to add this path is different with the root user.
for root user the output of the (echo $PATH is only two directories and is different with the user in use for the services.

Logs are as following:
#echo $PATH[/COLOR][/B]
/opt/local/bin:/opt/NSCPnav/bin:/oracle/db/product/11.1.0/db_1/bin:/enip/enipapp/cbp/add-ons/bin:/enip/enipapp/cbp/bin:/enip/enipapp/cbp/service/sys/servicerun/bin:/enip/enipapp/cbp/service/app/servicerun/bin:.:/opt/informix/informix_server/bin:/enip/enipapp/cbp/tools:/enip/enipapp/cbp/tools/bin:/enip/enipapp/cbp/ext/cbe/tools:/enip/enipapp/cbp/bin:/opt/freeware/bin:/usr/vacpp/bin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:/opt/ipf/bin:/opt/gvsd/bin:/opt/nettladm/bin:/opt/fcms/bin:/opt/wbem/bin:/opt/wbem/sbin:/opt/sas/bin:/opt/graphics/common/bin:/opt/atok/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/sec_mgmt/bastille/bin:/opt/caliper/bin:/opt/drd/bin:/opt/dsau/bin:/opt/dsau/sbin:/opt/resmon/bin:/opt/firefox:/opt/gnome/bin:/opt/ignite/bin:/opt/propplus/bin:/usr/contrib/kwdb/bin:/opt/mozilla:/opt/perl_32/bin:/opt/perl_64/bin:/opt/prm/bin:/opt/sfm/bin:/opt/swm/bin:/opt/sec_mgmt/spc/bin:/opt/ssh/bin:/opt/sentinel/bin:/opt/swa/bin:/opt/hpsmh/bin:/opt/thunderbird:/opt/langtools/bin:/opt/gwlm/bin:/opt/cfg2html:.:/opt/aCC/bin

 

the /ust/sbin must be added to the above path not to replace it!

the Profile:
cat /etc/profile


# @(#)B.11.31_LR 

# Default (example of) system-wide profile file (/usr/bin/sh initialization).
# This should be kept to the bare minimum every user needs.

# Ignore HUP, INT, QUIT now.

trap "" 1 2 3 

# Set the default paths - Do NOT modify these.
# Modify the variables through /etc/PATH and /etc/MANPATH 

PATH=/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin
MANPATH=/usr/share/man:/usr/contrib/man:/usr/local/man

# Insure PATH contains either /usr/bin or /sbin (if /usr/bin is not available).

if [ ! -d /usr/sbin ]
then
PATH=$PATH:/sbin

else if [ -r /etc/PATH ]
then

# Insure that $PATH includes /usr/bin . If /usr/bin is 
# present in /etc/PATH then $PATH is set to the contents 
# of /etc/PATH. Otherwise, add the contents of /etc/PATH 
# to the end of the default $PATH definition above.

grep -q -e "^/usr/bin$" -e "^/usr/bin:" -e ":/usr/bin:"\
-e ":/usr/bin$" /etc/PATH
if [ $? -eq 0 ]
then
PATH=`cat /etc/PATH`
else
PATH=$PATH:`cat /etc/PATH`
fi
fi
fi

export PATH

# Set MANPATH to the contents of /etc/MANPATH, if it exists.

if [ -r /etc/MANPATH ]
then
MANPATH=`cat /etc/MANPATH`
fi

export MANPATH

# Set the TIMEZONE 

if [ -r /etc/TIMEZONE ]
then
. /etc/TIMEZONE 
else
TZ=MST7MDT # change this for local time. 
export TZ
fi

# Be sure that VUE does not invoke tty commands

if [ ! "$VUE" ]; then

# set term if it's not set

if [ "$TERM" = "" -o "$TERM" = "unknown" -o "$TERM" = "dialup" \
-o "$TERM" = "network" ]
then
eval `ttytype -s -a`
fi

export TERM

# set erase to ^H, if ERASE is not set
if [ "$ERASE" = "" ]
then
ERASE="^H"
export ERASE
fi
stty erase $ERASE

# Set up shell environment:

trap "echo logout" 0


# This is to meet legal requirements...

cat /etc/copyright

# Message of the day

if [ -r /etc/motd ]
then
cat /etc/motd
fi

# Notify if there is mail

if [ -f /usr/bin/mail ]
then
if mail -e
then echo "You have mail."
fi
fi

# Notify if there is news

if [ -f /usr/bin/news ]
then news -n
fi

# Change the backup tape

if [ -r /tmp/changetape ]
then echo "\007\nYou are the first to log in since backup:"
echo "Please change the backup tape.\n"
rm -f /tmp/changetape
fi

fi # if !VUE

# Leave defaults in user environment.

trap 1 2 3 

for the root user:
echo $PATH

/usr/bin:/usr/sbin:/sbin

 

 

 

P.S. this thread has been moved from HP-UX > System Administration  to HP-UX > languages. - HP Forum Moderator

1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: Adding directories to PATH in HP-UX with csh

>I am trying to add some directories to the production HP-UX (like /usr/sbin)

 

First of all no sysadmin should be caught dead using the scummy C shell!

And ordinary csh users wouldn't need /usr/sbin in their paths.  And if they do, they already know how to do that.

I.e. you shouldn't enable their choice of a broken shell.  ;-)

 

>setenv but I failed.

 

setenv is the right command for csh.  But it needs to be in /etc/csh.login not /etc/profile.