Operating System - HP-UX
1754021 Members
7311 Online
108811 Solutions
New Discussion юеВ

Re: ~ not working on HP-UX 11.23

 
puth
Occasional Advisor

~ not working on HP-UX 11.23

My code is as follows

SHOME=/home/shome

if [ $(whoami) = root ]
then
export HOME=$SHOME
echo $HOME
ls -ltr ~

i get $HOME printed as /home/shome.but ls -ltr ~ is displaying the root list of files instead of /home/shome/ files.

Can anyone help me in understanding why ~ is not taking $HOME?
6 REPLIES 6
Steven Schweda
Honored Contributor

Re: ~ not working on HP-UX 11.23

> [...] on HP-UX 11.23

uname -a

man

See what it claims to do when you say "~".

My psychic powers are too weak to tell me
which shell you're using, but you might try
a different one to see if that would help.
Dennis Handly
Acclaimed Contributor

Re: ~ not working on HP-UX 11.23

If you use a real shell, it takes it from $HOME. If you use the scummy C shell, it looks at $home.
I'm not sure what shell would work as you said?
puth
Occasional Advisor

Re: ~ not working on HP-UX 11.23

I am using ksh
Mike Miller_8
Regular Advisor

Re: ~ not working on HP-UX 11.23

~ is the login directory for the given user (taken from the passwd file) - not the value of the $HOME parameter. Do a man on ksh and look for "Tilde Substitution".
puth
Occasional Advisor

Re: ~ not working on HP-UX 11.23

Wrong question
Dennis Handly
Acclaimed Contributor

Re: ~ not working on HP-UX 11.23

>Mike: ~ is the login directory for the given user (taken from the passwd file) - not the value of the $HOME parameter. Do a man on ksh and look for "Tilde Substitution".

That's not all that it says. If you have ~name, it comes from /etc/passwd, otherwise from $HOME.