Command line overwrite

is there a way to overwrite what I have typed in rather than having to hit enter and re enter the command?

SCO UNIX 3.2.4.2

What shell are you using?

# ps -p $$
PID TTY TIME COMMAND
954  p2   0:01   sh
# echo $SHELL
/bin/sh

Do you mean, to bring back a previous command or does your backspace not work?

I'm afraid you need to run a shell that uses the readline library or equivalent, like e.g. bash . You obviously have the unadorned sh running, the grand parent of almost all shells.

I am not sure if I understand the question correctly, but you could use ctrl-u to erase everything you typed in on the line so far and enter the new command rather than pressing the backspace multiple times.

I got to thinking that that was going to be the answer but I am not used to using sh. I'm more tuned to how bash works.

I was wondering if there was a way to clear a wrongly entered character. hitting backspace puts in a different character rather than removing the character.

Telling us that you're using /bin/sh without telling us what operating system you're using doesn't really tell us all that much. On many systems /bin/sh is a link to another shell (e.g., bash , dash , or ksh ). On at least one system /bin/sh is an honest to God 1980's Bourne shell. (When starting a thread on unix.com, please always tell us what operating system and shell you're using. Having some idea about the environment you're using will help us give you answers that stand a better chance of working in your environment.) Unfortunately, I have no idea what shell underlies /bin/sh on SCO systems.

On systems where /bin/sh is a link to a POSIX standards-conforming shell, you could try issuing the command:

set -o vi

to turn on vi command line editing mode. Once that has been done, if you hit the <escape> key while entering a command, you can use the usual vi editor commands to erase, replace, insert, and substitute text on that line and then hitting the <enter> or <retturn> key will submit that line to the shell for processing.

This means that your terminal and the system disagree on what character a backspace is.

What is your terminal?

That is in the OP

--- Post updated at 03:27 PM ---

SCO UNIX 3.2.4.2 does everything in command prompt(/bin/sh). No desktop.

Yes -- but what is your terminal? A permanently wired keyboard and monitor directly attached to the SCO machine? An instance of PUTTY running on Windows? A smartphone app? A printing teletype circa 1977? A generic beige VT100 attached to the serial port? Some sort of web gateway? Other?

Monitor and keyboard at the SCO machine. Putty on Windows 10 connecting over the network. QVTterm on a Windows 2000 VB image.
All 3 have the same results.

1 Like

Thank you. Try stty erase funny-character , where funny-character is the strange char you get hitting backspace. Just a temporary solution but if it works, that means SCO is configured to use the wrong kind of terminal.

I had myself screwed up. Its not the backspace that puts in special characters.
Its when you arrow left.

# cat /esc/hosts

Like if I arrow over to replace the s with a t

Try ksh to put you in a more full-featured shell.

1 Like