- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- stty erase / stty werase
Operating System - HP-UX
1820907
Members
4806
Online
109629
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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-25-2011 01:38 AM
тАО05-25-2011 01:38 AM
Hi,
I'm having a problem with stty. Whenever I hit 'backspace', instead of a single character, an entire word is deleted from the command line.
I've tried to set 'werase' in many different ways to avoid this word deletion but I'm not able to sort out the problem:
#> stty
speed 38400 baud; -parity hupcl
intr = ^C; erase = DEL; kill = ^U;
eol; swtch ;
susp = ^Z;
werase = DEL; lnext = ^V;
brkint -inpck -istrip icrnl -ixany onlcr tab3
-iexten echo -echoe -echok
-echoctl -echoke
#> stty werase '^W'
#> stty
speed 38400 baud; -parity hupcl
intr = ^C; erase = DEL; kill = ^U;
eol; swtch ;
susp = ^Z;
werase = ^W; lnext = ^V;
brkint -inpck -istrip icrnl -ixany onlcr tab3
-iexten echo -echoe -echok
-echoctl -echoke
#> stty werase undef
#> stty
speed 38400 baud; -parity hupcl
intr = ^C; erase = DEL; kill = ^U;
eol; swtch ;
susp = ^Z;
werase = u; lnext = ^V;
brkint -inpck -istrip icrnl -ixany onlcr tab3
-iexten echo -echoe -echok
-echoctl -echoke
I'm working with bash shell on a HP-UX B.11.11.
Could anybody lend me a hand?
Thanks in advance.
I'm having a problem with stty. Whenever I hit 'backspace', instead of a single character, an entire word is deleted from the command line.
I've tried to set 'werase' in many different ways to avoid this word deletion but I'm not able to sort out the problem:
#> stty
speed 38400 baud; -parity hupcl
intr = ^C; erase = DEL; kill = ^U;
eol
susp = ^Z;
werase = DEL; lnext = ^V;
brkint -inpck -istrip icrnl -ixany onlcr tab3
-iexten echo -echoe -echok
-echoctl -echoke
#> stty werase '^W'
#> stty
speed 38400 baud; -parity hupcl
intr = ^C; erase = DEL; kill = ^U;
eol
susp = ^Z;
werase = ^W; lnext = ^V;
brkint -inpck -istrip icrnl -ixany onlcr tab3
-iexten echo -echoe -echok
-echoctl -echoke
#> stty werase undef
#> stty
speed 38400 baud; -parity hupcl
intr = ^C; erase = DEL; kill = ^U;
eol
susp = ^Z;
werase = u; lnext = ^V;
brkint -inpck -istrip icrnl -ixany onlcr tab3
-iexten echo -echoe -echok
-echoctl -echoke
I'm working with bash shell on a HP-UX B.11.11.
Could anybody lend me a hand?
Thanks in advance.
Solved! Go to Solution.
- Tags:
- stty
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-25-2011 07:18 AM
тАО05-25-2011 07:18 AM
Solution
After making changes to stty settings, restart your bash shell.
Bash uses the readline library for command line editing. One of the features of the readline library is that at startup, it checks the stty settings for special characters and then binds those control characters to equivalent readline functions.
So, when you login, something has caused werase to be set to DEL, the same as erase. This clearly incorrect setting is copied to bash's readline keybindings.
When you use stty to change the werase character, you're changing only the stty setting; the equivalent readline mapping remains in the wrong value.
Try this after logging in:
stty werase '^W'
exec bash
The second command will cause the shell to be restarted, and it will have a chance to re-initialize the readline mappings to match the new stty values.
Alternatively, this bash command should explicitly unbind the word-erasing function:
bind -u unix-word-rubout
Once you get your shell environment fixed, it's time to try and find the root cause. Perhaps someone has made the incorrect "werase = DEL" setting as the default for all TTYs? To check this, run this command as root:
stty -a
You'll see the default settings for all TTY devices. If this includes the incorrect werase setting, you can fix it with:
stty werase '^W'
The default settings will revert to built-in kernel defaults when the system is rebooted. You might want to check your startup scripts and/or /etc/inittab: perhaps someone has made a less-than-successful customization to your system.
MK
Bash uses the readline library for command line editing. One of the features of the readline library is that at startup, it checks the stty settings for special characters and then binds those control characters to equivalent readline functions.
So, when you login, something has caused werase to be set to DEL, the same as erase. This clearly incorrect setting is copied to bash's readline keybindings.
When you use stty to change the werase character, you're changing only the stty setting; the equivalent readline mapping remains in the wrong value.
Try this after logging in:
stty werase '^W'
exec bash
The second command will cause the shell to be restarted, and it will have a chance to re-initialize the readline mappings to match the new stty values.
Alternatively, this bash command should explicitly unbind the word-erasing function:
bind -u unix-word-rubout
Once you get your shell environment fixed, it's time to try and find the root cause. Perhaps someone has made the incorrect "werase = DEL" setting as the default for all TTYs? To check this, run this command as root:
stty -a
You'll see the default settings for all TTY devices. If this includes the incorrect werase setting, you can fix it with:
stty werase '^W'
The default settings will revert to built-in kernel defaults when the system is rebooted. You might want to check your startup scripts and/or /etc/inittab: perhaps someone has made a less-than-successful customization to your system.
MK
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-26-2011 02:57 AM
тАО05-26-2011 02:57 AM
Re: stty erase / stty werase
The strange thing is that in the default settings "werase" is Ok:
#> stty -a min = 4; time = 0;
intr = DEL; quit = ^\; erase = #; kill = @
eof = ^D; eol = ^@; eol2; swtch
stop = ^S; start = ^Q; susp; dsusp
werase; lnext
I'm not able to find the file/script where "stty werase..." could be set. I'll keep on searching.
Both methods you propose ("exec bash" or "bind -u...") works as expected.
For the moment I've set it in my .bash_profile and it works properly (before I was trying to set in /etc/profile and from command line but, as seen, it didn't work):
#> grep werase .bash_profile
stty werase '^W'
#> stty -a | grep werase
werase = ^W; lnext = ^V
Thanks a lot for your help.
Luisma Arranz
#> stty -a min = 4; time = 0;
intr = DEL; quit = ^\; erase = #; kill = @
eof = ^D; eol = ^@; eol2
stop = ^S; start = ^Q; susp
werase
I'm not able to find the file/script where "stty werase..." could be set. I'll keep on searching.
Both methods you propose ("exec bash" or "bind -u...") works as expected.
For the moment I've set it in my .bash_profile and it works properly (before I was trying to set in /etc/profile and from command line but, as seen, it didn't work):
#> grep werase .bash_profile
stty werase '^W'
#> stty -a | grep werase
werase = ^W; lnext = ^V
Thanks a lot for your help.
Luisma Arranz
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP