Operating System - HP-UX
1825795 Members
2385 Online
109687 Solutions
New Discussion

Re: Command aliases /bin/sh

 
SOLVED
Go to solution
Carl Houseman
Super Advisor

Command aliases /bin/sh

HP-UX 11.11...

Trying to define aliases for a user using /bin/sh. I've added the alias to .profile and it works for a telnet session, but not for a CDE xterm. I have uncommented DTSOURCEPROFILE=true in the .dtprofile and verified that the .profile and my alias command are executed, but the alias is not there. I've even tried alias -x in the .profile, no change for the xterm.

Meanwhile, there are system-wide aliases showing up in both telnet and CDE xterm sessions. Where are those defined? Not in /etc/profile.

thanks for putting up with my n00b question...
3 REPLIES 3
Bill Hassell
Honored Contributor
Solution

Re: Command aliases /bin/sh

Not a noob questions, but a very obscure 'feature' in Xwindow terminal emulators xterm, hpterm and dtterm. These emulators by default do not login in a 'normal' way and therefore do not start a login shell. While you can set the variable in .dtprofile, the correct way to match Xwindows with a normal modem/serial or telnet login (so it executes /etc/profile and then .profile, the normal way) is to create this file in each user's $HOME directory:

echo "*loginShell: true" >> $HOME/.Xdefaults

Now, each terminal window will login the same way as a telnet login.

BTW: there is no program /bin/sh in HP-UX (or Solaris for that matter). If you look at the /bin directory with:

ll -d /bin

you'll see that this is not a directory but a temporary transition link. The real location for /bin files is /usr/bin so all your users should have /usr/bin/sh (or whatever shell they use) in /etc/passwd. This directory has been standard for SysV (v.4 filesystem layout) for more than 10 years. HP will be removing these links in future revisions as part of a normal installation although tlinstall will still exist for a while.


Bill Hassell, sysadmin
TwoProc
Honored Contributor

Re: Command aliases /bin/sh

I'm not sure why you're broken (I'm guessing that the terminal you're running isn't in "sh" but something else, so the environment vars didn't come over - OR you didn't "export" the variables in the .profiles. My guess is that the vars aren't exported after being defined.

A possible fix for this is to put the variable assignment and export command you want run in the ".shrc" file (.bashrc .cshrc .tcshrc .kshrc, whichever shell you're running). This will make the assignment everytime the shell is invoked as opposed as to every time a login occurs.

"echo $0" from inside your terminal to find out what shell you're actually running once at a prompt.

We are the people our parents warned us about --Jimmy Buffett
Carl Houseman
Super Advisor

Re: Command aliases /bin/sh

FWIW my shell was /usr/bin/sh. I had tried .bashrc and .shrc but neither did anything.

Bill's answer did the trick. Thanks Bill.