- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Arrow keys to browse history
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2004 02:22 AM
05-31-2004 02:22 AM
Arrow keys to browse history
I have now got a problem using the arrow keys to browse the history. Using the following in the .profile for each user works fine.
set -o emacs
alias __A="^P"
alias __B="^N"
However, if I place the following in the /etc/profile to be used for every user.
set -o emacs
alias __A="^P"
Nothing happens. If I place the following in the /etc/profile.
set - emacs
alias __A="^P"
alias __B="^B"
The arrow keys still don't browse the history but if I then try the alias command, the output from the console turns into garbage like the following.
__A=
__B=
jâ ¬`â ¡gΦΦΩδΠ⠩â e
â ©â eâ ¬`â ¡gΦΦΩδÎ
The prompt and any further output from the shell also show up as garbage. However, if I copy the garbage and paste it into another application in windows for example, the garbage turns into real text.
Everything works fine if I place these changes in the .profile for each user. It's only when I put it in /etc/profile that things
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2004 02:50 AM
05-31-2004 02:50 AM
Re: Arrow keys to browse history
Look at the link
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=604661
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2004 02:57 AM
05-31-2004 02:57 AM
Re: Arrow keys to browse history
That link describes placing the changes in each users ~/.profile. But I want each user to be able to use this facility without having to change each users .profile seperately. So I'm trying to put it in /etc/profile (the default profile). Things like prompts and other alias commands work fine in /etc/profile but the emacs features to browse the history won't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2004 03:59 AM
05-31-2004 03:59 AM
Re: Arrow keys to browse history
I have discovered that placing set -o emacs in the etc/profile is the problem. It doesn't run there for some reason. If I have the
set -o emcas
in ~/.profile, I can have the
alias __A="^P"
in /etc/profile
Although this enables the browsing history with the arrow keys, it still displays the garbage when I execute the alias command at the shell prompt. And it still means changing ~/.profile for each user which I don't really want to do. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2004 09:50 AM
05-31-2004 09:50 AM
Re: Arrow keys to browse history
eval $(ttytype -s)
and remove any other TERM settings in .profile or other login steps. The weird characters may be caused by stty settings. The following is a good set for /etc/profile:
export TERM=$(ttytype -s)
stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff
stty susp \^Z dsusp \^Y
tput reset
tput rmln
As with all profiles, if you use batch software to start processes such as a database and the startup sequence uses su, be sure to protect all terminal commands from being executed in batch mode (where there is no associated tty device). Something like this:
if tty -s
then
...bunch of stty,tput,ttytype,tabs,etc commands
fi
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2004 07:47 PM
05-31-2004 07:47 PM
Re: Arrow keys to browse history
eval $(ttytype -s)
So the login process now has the following in /etc/profile and nothing related to this in .profile.
export TERM=$(ttytype -s)
stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff
stty susp \^Z dsusp \^Y
tput reset
tput rmln
.sh_history is still being written to but the arrow keys wont show the history and I'm still getting the strange characters after the entering the alias command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2004 02:18 AM
06-01-2004 02:18 AM
Re: Arrow keys to browse history
tput smkx
cat | xd -cx
There won't be any prompts, just start typing and enter CTRL-D to exit. After CTRL-D, you'll see the codes that were transmitted. The strange characters look like ASCII characters with the 8th bit turned on. Check your terminal emulator manual to see how these codes are handled.
Are you using /usr/bin/sh (the POSIX shell)? bash has it's own list of possible profile files that may be doing some setups.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2004 03:28 AM
06-01-2004 03:28 AM
Re: Arrow keys to browse history
When I run xd and type the up arrow and enter followed by CTRL-D, I get.
0000000 1b4f 410a
1b O A \n
0000004
In terms of shells, root uses /sbin/sh while normal users use /usr/bin/sh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2004 03:56 AM
06-01-2004 03:56 AM
Re: Arrow keys to browse history
untic vt100 | grep kuuc1
knp=\E[U, kpp=\E[V, kcuf1=\EOC, kcuu1=\EOA,
where \EOA is the until way of saying ESC OA will be expected from a vt100 terminal (o remulator) when the arrow key is pressed. What does ttytype -s say about your terminal? Programs (such as the POSIX shell which you are using) that use the Curses library will expect the value of TERM to match what the emulator does. If ttytype -s reports TERM=ansi then your emulator is flawed or misconfigured. An ANSI type terminal (untic ansi) will transmit ESC [A not ESC OA. You may have to give up on the emulator you're using if this is the case. There a LOT of terminal emulators out there, some of which appear to be written by programmers that may never have touched a 'real' terminal or know much about terminal codes and responses.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2004 08:31 PM
06-01-2004 08:31 PM
Re: Arrow keys to browse history
set -o emacs
alias __A="^P"
in ~/.profile works fine for that particular user. It's only if I try to do this in /etc/profile that I get a problem and this is what I don't understand. If my emulator was faulty, I wouldn't expect it to work either way.
ttytype -s gives:
TERM='vt320'; export TERM;
LINES=24; export LINES;
COLUMNS=80; export COLUMNS;
ERASE='^?'; export ERASE;
Oh, and I only get garbage after typing alias at the prompt if I have
alias __B="^N" in /etc/profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2004 08:33 AM
07-28-2004 08:33 AM
Re: Arrow keys to browse history
I too am attempting to get my arrow keys working. I found a lot of ideas from this listserv.
I edited my .profile file and added
alias __B="^P"
however, my down arrow key now prints ^P and not the actual escape sequence of CTRL-P. What do I need to enter in my .profile for ^P to make my system work.
key-less in Chicago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2004 09:05 AM
07-28-2004 09:05 AM
Re: Arrow keys to browse history
It's working...
Here is what I used:
alias -x __A="$(echo '\020')" #
alias -x __B="$(echo '\016')" #
alias -x __C="$(echo '\006')" #
alias -x __D="$(echo '\002')" #
joe...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2004 02:00 AM
09-24-2004 02:00 AM
Re: Arrow keys to browse history
__B
__C
__D
Where can I find this codes to any ather key
(Delete, Insert, Home, End, PageUp, PageDown, etc.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2004 02:10 AM
09-24-2004 02:10 AM
Re: Arrow keys to browse history
joe...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2005 09:25 PM
06-20-2005 09:25 PM
Re: Arrow keys to browse history
here needs an update ...
Just the people above, I have managed to map arrow keys and command history with
alias -x blah blah..
but when I want this setting to be common for everyone, I had to put it in /etc/profile.. And of course it didn't work (here is unix world ..!)
So as stated above, the problem was with "set -o emacs". SOmehow it conflicts with the user .profile's last lines
# Set up the shell variables:
EDITOR=vi
export EDITOR
when I delete those lines. set-o emacs line in /etc/profile has worked !
By the way, I suggest to remove these lines from /etc/skel/.profile (for ksh)
so that new users can be crated without problems..