Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix command line editing - unknown shell 3

Status
Not open for further replies.

ernieah

Programmer
Oct 27, 2002
42
US
(1) Unix: I am entering commands in a "unknown shell", in a mission critical application where I DARE NOT disturb the shell or the program. As far as I'm concerned "editing" a previous "command line" for this application is a "black box" problem. I am anxious about using stty or tset, etc., since I don't know much about them, and since I don't want to "disturb" this critical application, and I'm not allowed to make ("experimetal" to me) changes.

(2) When I make an ERROR on the command line, and "bring that line back up", I hope to correct the error without having to re-type the whole line. I "bring up" he previous command line simply by pressing the up-arrow key one-or-more times until I get the (previous) command line i want to be "showing".

(3) So far, the only "command-line' edit-command i have that
"works" is <Ctrl> + <u>. The DOES erase the "showing" command line, and enables me to type a new command.

This has limited usefulness, since re-typing the entire line is extra work, compared to corresting, or replacing a character or two.

I have NOT been able successfully to REPLACE some character in my previous command (for example to replace the number "3" with the number "2"), instead of having to re-type the entire line.

(5) The "vi" replace-character does NOT work. Neither does the ordinary (to me) destructive backspace (the <Backspace>-key).

(6) IF I switch to the "ksh" shell, with the idea of then using "set -o vi", I lose my prompt in the original shell and I am loath to "lose that prompt", since other users will complain that the window does'nt look right.

Without changing to the "ksh" shell, the "set -o vi" command do NOT seem to work, on this command line. For example, to
replace one character with another on the "previous" command line which is "showing", before I press the <enter> key to execute the revised command.

(7) How can I determine what shell I'm in (if that's what I need to know), or what are some GENERAL command-line editing commands (in addition to <Ctrl>-<u>)?

Thanx in advance

End-of-memo: Best to you..from ernieah.
I don't sell books, or work for any
publisher or computer company.
 
I'm guessing bash, but your backspace key is not generating the correct control-char that your stty settings expect it to be

try the commands

$ echo $$

this gives the process id of your shell

then

$ ps

look for the process name of the process with the process id of your shell - it would probably show as -bash

when in editing mode, use the arrow keys to position the cursor after a char to erase, then either push ctrl-H or ctrl-backspace to erase the char before the cursor.

if that doesn't work, show us what

$ stty -a

gives as output (that doesn't change anything, it just reports the settings)


HTH,

p5wizard
 
If you are using non-csh, i.e. ksh/bash/zsh, if you are at our parent shell, execute:

echo $0

and it'll tell you what your shell is.

Obviously, within a shell script, this doesn't work.
 
Also, try set -o to display the current shell's options, and possibly identify what editing mode it is in.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top