Operating System - HP-UX
1820100 Members
3584 Online
109608 Solutions
New Discussion юеВ

Re: Alias not working sometimes

 
SOLVED
Go to solution
Suren Selva_1
Advisor

Alias not working sometimes

Hello,

I use aliases to make my work easier. Sometimes I find that the aliases do not work. Any idea why this happens? Thanks for all responses.

Regards,
Suren Selva
Live and let live!
8 REPLIES 8
Todd McDaniel_1
Honored Contributor

Re: Alias not working sometimes

What is your alias setup? and have you aliased commands that are current unix commands...

Post your alias so we can help diagnose it.
Unix, the other white meat.
Umapathy S
Honored Contributor

Re: Alias not working sometimes

Suren,
When you are saying sometimes, can you pinpoint those occasions. Is it during a plain tty session or a CDE session?

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Steven E. Protter
Exalted Contributor
Solution

Re: Alias not working sometimes

This probelm is mostly environmental.

What I mean is that under certain circumstances the aliases are probably not getting loaded.

The places to look include /etc/profile and .profile for the user.

When it works try this:
env > /tmp/good.txt

When it doesn't
env > /tmp/bad.txt

then diff /tmp/good.txt /tmp/bad.txt

That will identify the issue and let you solve it.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Bill Hassell
Honored Contributor

Re: Alias not working sometimes

Almost always, this is a profile issue and is associated with Xwindows where the default is to totally ignore standard Unix login profiles. You can verify this by putting and echo "running .profile" at the beginning of your $HOME/.profile and if you don't see the message, .profile was never run.

A 'normal' telnet connection will run .profile, but remsh will not, nor will an VUE or CDE login using one of the desktop terminal icons. You'll need to add a *loginShell:true to your $HOME/.Xdefaults file to get a true login.


Bill Hassell, sysadmin
Todd McDaniel_1
Honored Contributor

Re: Alias not working sometimes

Bill,

Can your put a line in /etc/profile to reference $USER/.profile?

Seems like that would work in the of non-telnet logins.
Unix, the other white meat.
Suren Selva_1
Advisor

Re: Alias not working sometimes

This happens during a tty session. It has not happened since the last time on Friday. The commmand I am using is

lp='lp -oc -dprinter'

-Suren
Live and let live!
Dave La Mar
Honored Contributor

Re: Alias not working sometimes

Suren -
In a basic HP-UX class, we were advised to place the alias in our corresponding shell .xxxrc file.
i.e. .kshrc or .cshrc.
Having done that, I have not seen the problem in our environment.

Best regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Bill Hassell
Honored Contributor

Re: Alias not working sometimes

The problem is that /etc/profile is NEVER executed by default in the CDE and VUE environments. Here is ho9w a 'normal' telnet login works:

- telnet from the client contacts telnetd in HP-UX
- login/password are requested and one authenticated, the user shell is started as a login process. For Bourne, Korn, POSIX (and even Bash), /etc/profile is then sourced
- Once /etc/profile is sourced, the user's local profile is run. Now it gets complicated: Bourne, Korn and POSIX shells will read .profile, Bash will read .bash_profile, .bash_login, and ~/.profile in that order if they are readable.

SO it is not necessary to add .profile to /etc/profile at all. The problem occurs with the obtuse defaults for CDE and VUE. In this case, users often use the desktop icons for terminals (xterm, dtterm and hpterm) and unfortunately, the default is to start the window and run the shell without the 'loginShell' option. So neither /etc/profile nor .profile will lbe run at all. To fix this bizarre (by Unix standards) behavior, you need to tell the terminal emulators to perform a 'normal' login. On the machine acting as a CDE or VUE server, run this command:

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

and now each terminal will actually run /etc/profile then .profile. Verify this with simple echo statements in both files.


Bill Hassell, sysadmin