: I want to write a shell script that - after some internal processing - should
: offer me a proposed command in the command line. Principally I want just type
: <ENTER> but I want also to be able to do some corrections via command line
: editing (ksh, zsh, bash). Is there a corresponding command as
: simple as an "echo"? Or must I use complex tools as for e.g. "expect"?
You do not describe well enough the particular application you will
to specifically solve for me to confidently recommend one of several
pseudo-terminal command-line editting front-ends that are freely
available. Is the below to your liking?
fep/part[01-05] Front end editor program
atty/part[01-04] A command-line editor (for BSD)
There are also C libraries which can do such things, but I would
simply write my own command-line front-end (that is, if you _did_
read the ksh man pages concerning ksh very powerful builtin
command-line re-editting features!)
set -o vi
while IFS= read -r
do read -rs
# (do your command-line processing stuff here...)
print -s "REPLY"
If I am not mistaken (my ISP uses a system supporting only pdksh, not
actual kornshell, so this is from memory) the act of reading in input
will enable potential history substitution (type an ESCAPE, then "k"
to find out if this is implemented on your ksh.)