2

Whenever I type a mistake into my SCO machine, using bash, I press backspace and it is like pressing enter, but doesn't execute the command.

e.g.

bash-3.1$ ifcomfig "(backspace)"
bask-3.1$ 

But if I pressed enter, then it would be like this:

bash-3.1$ ifcomfig "(enter)"
bash: ifcomfig: command not found
  • Why is it doing this?
  • And how can I fix this?

Thank you

Update

Here is the output of stty -a:

speed 38400 baud;   ispeed 38400 baud;   ospeed 38400 baud;   line = 0(tty);
rows = 100; columns = 92; ypixels = 0; xpixels = 0;
intr = DEL; quit = ^\; erase = DEL; kill = ^U; eof = ^D; eol = ^@;
swtch = <undef>; susp = <undef>; start = ^Q; stop = ^S;
-parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk
-ortsfl -ctsflow -rtsflow
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -iuclc
-ixon -ixany -ixoff
isig icanon -xcase echo -echoe -echok -echonl -noflsh
-iexten -tostop -xclude
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel
-isscancode
-autoe -ed_emacs -ed_vi -ed_history
Kevdog777
  • 3,194
  • 18
  • 43
  • 64

1 Answers1

7

It's possible that the backspace key on the keyboard may actually be generating the DEL character. That's sort of confirmed by the fact that both intr and erase are set to DEL according to your stty -a output. I have no idea which one would be given priority in that case since I've never been foolish enough to try it :-) (a)

A quick way to confirm would be to enter:

stty intr '^C'

in your terminal session, which will change it to CTRL-C and then see what backspace does.

If that then starts working okay, you need to find where the intr keystroke is being set and stop it from happening, or just set it to ^C as the last thing in your profile (overriding the errant setting).


(a) Although, actually, I've just given it a shot by setting both my intr and erase to ^? (my backspace character), and the interrupt nature takes over.

  • Genius!!! Thank you, it has worked properly now. – Kevdog777 Aug 16 '12 at 10:12
  • 1
    @paxdiablo Beat me to it : ) – djf Aug 16 '12 at 10:13
  • 1
    Sorry, @djf, I don't normally hang out here (I'm an SO guy mostly), I just came over to check up on my SLES11 question and got carried away :-) –  Aug 16 '12 at 10:15
  • @djf, haha I knew you were going to give an answer. But thanks for asking me for that `stty -a` – Kevdog777 Aug 16 '12 at 10:16
  • @paxdiablo @Kevdog777 No problem. I'm glad you could fix it using `stty`. I my mind I was already falling down the Termcap/Terminfo rabbit hole... you don't wanna go there. – djf Aug 16 '12 at 10:19
  • @paxdiablo: it sure looks like you are an SO guy, whoa! Thanks again. So I have just done `stty intr '^C'`, will that stay when I log off? Or do I need to add it to my `.profile` as well? – Kevdog777 Aug 16 '12 at 10:19
  • @Kevdog777: No, that'll only do it for the current terminal. You need to put it somewhere where it's run every login (such as the profile). –  Aug 16 '12 at 10:24
  • I added the `stty intr '^C'` to my .profile (as a test user - /u/test/.profile) and logged off and back on, and it is back to the old problem. – Kevdog777 Aug 16 '12 at 10:30
  • 1
    @Kev, you need to look into what profile scripts are running when you "log on". Whether .profile, .bash_profile, .bashrc and a host of other files are run is controlled by how you're logging on and off (eg. via text mode or gdm for example). Bottom line, if you "log in" and stty -a shows the old setting, then .profile wasn't run. That's a totally different problem. Unfortunately, I have no experience with SCO UNIX. –  Aug 16 '12 at 10:33
  • Sweet! It was using my `.bashrc` config file. – Kevdog777 Aug 16 '12 at 10:38