Operating System - HP-UX
1833323 Members
3116 Online
110051 Solutions
New Discussion

Re: posix shell and tilde substitution

 
Tom Fellowes
Advisor

posix shell and tilde substitution

We are upgrading from HP-UX 10.20 to HP-UX 11i (11.11 32-bit). We are running NIS (not NIS+). When I am on one of our systems that is NOT the NIS master (so the /etc/passwd file has only the necessary entries and + at the end) I see the following:

- when running /sbin/sh on 11.11:
cd ~smith
/sbin/sh: ~smith: not found.
- when running /sbin/sh 10.20:
cd ~smith
changes to the home directory listed for account smith in the NIS passwd file.

/usr/bin/sh on 11.11 does correctly change the directory.

I thought /sbin/sh was a superset of /usr/bin/sh. Why doesn't /sbin/sh on 11.11 expand the ~smith to the home directory listed for smith in the NIS passwd file? It works correctly for accounts that are in the local /etc/passwd file.
12 REPLIES 12
A. Clay Stephenson
Acclaimed Contributor

Re: posix shell and tilde substitution

Well, the only difference between /sbin/sh and /usr/bin/sh is supposed to be that the /sbin version is statically linked. I suspect what is really diffrent is that ${HOME} is slightly different. In any event, I would really consider cd ~smith to be working by accident and instead always use cd ~/smith.
If it ain't broke, I can fix that.
Bharat Katkar
Honored Contributor

Re: posix shell and tilde substitution

Hi,
I tested with both the shells, it works fine.

For HPUX 11.00

# pwd
/
# /sbin/sh
#
#
# cd ~bharat
# pwd
/home/bharat
#
#
# /usr/bin/sh
# cd ~bharat
# pwd
/home/bharat
#

You need to know a lot to actually know how little you know
curt larson_1
Honored Contributor

Re: posix shell and tilde substitution

i'd be looking to see what is the user smith's home directory and does it exist on the system. not found, the system can not find it the way things are currently set up. the tilde subsitution was probably done right.
Tom Fellowes
Advisor

Re: posix shell and tilde substitution

Just a reply to the last few messages:

I'm running 11.11. Maybe it worked on 11.0 but changed on 11.11.

The cd to ~accountname fails for all accounts except root if I use /sbin/sh. There is nothing wrong with the user's directories.
Pete Randall
Outstanding Contributor

Re: posix shell and tilde substitution


I don't know - it certainly seems to work for me on 11.11:

root# /sbin/sh
root# cd ~plr
root# pwd
/home/plr
root# /usr/bin/sh
root# cd ~plr
root# pwd
/home/plr
root# uname -a
HP-UX tsws1 B.11.11 U 9000/785 2006183676 unlimited-user license


Pete

Pete
Tom Fellowes
Advisor

Re: posix shell and tilde substitution

Pete:

Could you please provide a cksum listing (or something) of /sbin/sh and /usr/bin/sh on your system? I'd like to do a comparison. Maybe I'm missing a patch.
Bharat Katkar
Honored Contributor

Re: posix shell and tilde substitution

# cksum /sbin/sh
228930643 421888 /sbin/sh
# cksum /usr/bin/sh
3767272582 221184 /usr/bin/sh
You need to know a lot to actually know how little you know
Tom Fellowes
Advisor

Re: posix shell and tilde substitution

Nothing personal Bharat, but you listed that you were running 11.0. I'm running 11.11 (as Pete listed he was).

Pete?

TIA
Bharat Katkar
Honored Contributor

Re: posix shell and tilde substitution

Tom,
I am in flow ... !!!
Will take care next time ..
Please discard that one.


You need to know a lot to actually know how little you know
Pete Randall
Outstanding Contributor

Re: posix shell and tilde substitution

Tom,

Sorry - I answered in your other thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=587517





root# what /sbin/sh
/sbin/sh:
builtin.c $Date: 2002/04/02 01:28:34 $Revision: r11.11/2 PATCH_11.11 (P
HCO_25597)
macro.c $Date: 2002/04/02 01:54:01 $Revision: r11.11/2 PATCH_11.11 (PHC
O_25597)
service.c $Date: 2002/04/02 02:30:15 $Revision: r11.11/2 PATCH_11.11 (P
HCO_25597)
xec.c $Date: 2002/04/02 02:40:43 $Revision: r11.11/3 PATCH_11.11 (PHCO_
25597)
main.c $Date: 2001/05/16 04:21:54 $Revision: r11.11/1 PATCH_11.11 (PHCO
_23871)
arith.c $Date: 2002/04/02 01:24:24 $Revision: r11.11/2 PATCH_11.11 (PHC
O_25597)
assign.c $Date: 2002/04/02 01:19:14 $Revision: r11.11/2 PATCH_11.11 (PH
CO_25597)
edit.c $Date: 2002/04/02 01:36:24 $Revision: r11.11/2 PATCH_11.11 (PHCO
_25597)
error.c $Date: 2002/04/02 01:39:21 $Revision: r11.11/2 PATCH_11.11 (PHC
O_25597)
growaray.c $Date: 2002/04/02 01:42:31 $Revision: r11.11/2 PATCH_11.11 (
PHCO_25597)
history.c $Date: 2002/04/02 01:46:03 $Revision: r11.11/2 PATCH_11.11 (P
HCO_25597)
io.c $Date: 2002/04/02 01:48:55 $Revision: r11.11/2 PATCH_11.11 (PHCO_2
5597)
streval.c $Date: 2002/04/02 02:32:42 $Revision: r11.11/2 PATCH_11.11 (P
HCO_25597)
strmatch.c $Date: 2001/05/16 04:21:54 $Revision: r11.11/1 PATCH_11.11 (
PHCO_23871)
test.c $Date: 2002/04/02 02:36:24 $Revision: r11.11/2 PATCH_11.11 (PHCO
_25597)
vi.c $Date: 2002/04/02 02:38:28 $Revision: r11.11/2 PATCH_11.11 (PHCO_2
5597)
$Revision: @(#) all CUP11.11_BL2002_0414_1 PATCH_11.11 PHCO_25597
Sun Apr 14 01:47:56 PDT 2002 $
Version M-11/16/88f
$ B.11.11_LR Feb 8 2002 01:56:21 $
$ Version_11.11 Apr 12 2002 08:31:48 $



root# what /usr/bin/sh
/usr/bin/sh:
builtin.c $Date: 2002/04/02 01:28:34 $Revision: r11.11/2 PATCH_11.11 (P
HCO_25597)
macro.c $Date: 2002/04/02 01:54:01 $Revision: r11.11/2 PATCH_11.11 (PHC
O_25597)
service.c $Date: 2002/04/02 02:30:15 $Revision: r11.11/2 PATCH_11.11 (P
HCO_25597)
xec.c $Date: 2002/04/02 02:40:43 $Revision: r11.11/3 PATCH_11.11 (PHCO_
25597)
main.c $Date: 2001/05/16 04:21:54 $Revision: r11.11/1 PATCH_11.11 (PHCO
_23871)
arith.c $Date: 2002/04/02 01:24:24 $Revision: r11.11/2 PATCH_11.11 (PHC
O_25597)
assign.c $Date: 2002/04/02 01:19:14 $Revision: r11.11/2 PATCH_11.11 (PH
CO_25597)
edit.c $Date: 2002/04/02 01:36:24 $Revision: r11.11/2 PATCH_11.11 (PHCO
_25597)
error.c $Date: 2002/04/02 01:39:21 $Revision: r11.11/2 PATCH_11.11 (PHC
O_25597)
growaray.c $Date: 2002/04/02 01:42:31 $Revision: r11.11/2 PATCH_11.11 (
PHCO_25597)
history.c $Date: 2002/04/02 01:46:03 $Revision: r11.11/2 PATCH_11.11 (P
HCO_25597)
io.c $Date: 2002/04/02 01:48:55 $Revision: r11.11/2 PATCH_11.11 (PHCO_2
5597)
streval.c $Date: 2002/04/02 02:32:42 $Revision: r11.11/2 PATCH_11.11 (P
HCO_25597)
strmatch.c $Date: 2001/05/16 04:21:54 $Revision: r11.11/1 PATCH_11.11 (
PHCO_23871)
test.c $Date: 2002/04/02 02:36:24 $Revision: r11.11/2 PATCH_11.11 (PHCO
_25597)
vi.c $Date: 2002/04/02 02:38:28 $Revision: r11.11/2 PATCH_11.11 (PHCO_2
5597)
$Revision: @(#) all CUP11.11_BL2002_0414_1 PATCH_11.11 PHCO_25597
Sun Apr 14 01:47:45 PDT 2002 $
Version M-11/16/88f
$ B.11.11_LR Feb 8 2002 01:56:21 $


Pete

Pete
Tom Fellowes
Advisor

Re: posix shell and tilde substitution

Thanks Pete. I'm at patch level PHCO_27345, which adds more to both /sbin/sh and /usr/bin/sh. Don't know if the patch is the cause of the problem. I checked the most recent patch PHCO_28832 but I don't see a fix that looks like the problem I'm having. Unless anyone else has ideas, I'll have to put in an offical call to HP.

Thanks All!
Marvin Strong
Honored Contributor

Re: posix shell and tilde substitution

Well, I'm going to take a guess, and say that it is something to do with NIS configuration or lack of NIS on that server. However, I don't know exactly where to tell you to look.