1832977 Members
2817 Online
110048 Solutions
New Discussion

.profile help

 
SOLVED
Go to solution
SM_3
Super Advisor

.profile help

I have
stty erase ^H
in .profile
but when I log in I cannot use backspace and have to set stty erase manually.

How can I get the .profile to work automatically?

Thanks.
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: .profile help

First, if this is a CDE login, make certain that DTSOURCEPROFILE=true is set in .dtprofile.

Next check .profile to see if any if conditions might cause this portion of the code not to be executed.

Also, you should eclose the stty arguments in quotes:

e.g. stty erase "^H"

Finally, don't overlook the obvious. You stty may be overridden by later stty commands especially if your .profile sources other scripts.
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: .profile help

We have this code in /etc/profile for all users, which should work the same in .profile

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

I'd run through /etc/profile and .profile and see if the settings are overwritten.

Further, your terminal software can sometimes be incompatible with this setting, and some detail on this would be helpful. What client are we using?

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
SM_3
Super Advisor

Re: .profile help

using Reflection for Digital and Unix.

The "^H" worked!

thanks
Bill Hassell
Honored Contributor

Re: .profile help

There are several problems are going on. Reflection for DEC/Unix has an annoying default backspace setting (well OK, not annoying to VMS users, but the rest of us really think backspace should = backspace). Backspace = DEL is the default setting. That's why typing CTRL-H on your keyboard works OK but the backspace key shows ^? when you try to backspace. In your Reflection menu, select:

Setup -> Terminal -> Keyboard

and change "VT Backspace sends" from Delete to Backspace. That takes care of your emulator.

Now login (the actual character-mode prompt, not an Xwindow CDE or VUE login window) defaults to the (very) old standard of backspace = # and delete-line = @. These were very common character codes in the days when terminals had paper and ink (ie, a Teletype machine or similar). Can't really backspace on a paper terminal to erase characters...

So to fix this problem with the login program, HP-UX 11.0 and higher has added a new device file: /dev/ttyconf which is used to establish new defaults for stty settings prior to login and /etc/profile. You can do this:

/sbin/stty erase "^H"

or better yet:

/sbin/stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff

which sets all the important values. Once issued, this command changes the defaults for all new logins and 'sticks' between reboots. Note that the console default will not take effect until a reboot has occcurred. However, I have noticed that it doesn't always 'stick' (may be a patch issue) so I run it in cron around 2am in the morning.


Bill Hassell, sysadmin
Mike Stroyan
Honored Contributor

Re: .profile help

A. Clay Stephenson wrote-

| First, if this is a CDE login, make certain
| that DTSOURCEPROFILE=true is set in .dtprofile.

But a CDE login does not source ~/.profile for each login when DTSOURCEPROFILE=true. That flag says to source ~/.profile once when logging in to CDE. It is important to avoid tty operations in .profile at that time. Commands like stty and tset need to be protected from running by a test like-
if [ ! "$DT" ]; then
stty erase "^H"
fi
Otherwise a failing .profile command could prevent a CDE login from working.

CDE terminal emulators normally get their initial tty settings from an X resource. The /usr/dt/config/C/sys.resources file contains a default setting of "sys.resources:*ttyModes: erase ^H intr ^C kill ^U start ^Q stop ^S swtch ^@ susp ^Z" which the terminal emulators such as dtterm use.

It is also possible to set resources or options to cause terminal emulators to start a login shell that will source ~/.profile at startup.