Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KornShell (ksh) wraparound

Okay, I am sure this is simple but it is driving me nuts. I recently went to work on a program where I have had to step back in time a bit and use Redhat 9. When I'm typing on the command line from a standard xterm running KornShell (ksh), and I reach the end of the line the screen slides to the right (cutting off the left side of my command) instead of wrapping the text around to a new line. This makes things difficult for me because I can't easily copy and paste from the previous command straight from the command line. I have to look at the history and paste the command from there. In case you are wondering, I do a lot of command-line awk scripts that cause the line to get quite long.

Is there a way to force the command line to wrap instead of shifting visibility to the right side of the command I am typing?

I have poured through man page options with no luck.

I'm running:

  • XFree86 4.2.99.903(174)
  • KSH 5.2.14.

Thanks.

like image 499
Allen Ratcliff Avatar asked Sep 26 '08 20:09

Allen Ratcliff


People also ask

What is Korn shell used for?

The Korn Shell, or POSIX Shell, lets you perform command substitution. In command substitution, the shell executes a specified command in a subshell environment and replaces that command with its output. The Korn shell or POSIX shell regular built-in let command enables you to perform integer arithmetic.

Is ksh Korn shell?

The ksh command invokes the Korn shell, which is an interactive command interpreter and a command programming language. The shell carries out commands either interactively from a terminal keyboard or from a file.

Is ksh a kind of shell?

KornShell ( ksh ) is a Unix shell which was developed by David Korn at Bell Labs in the early 1980s and announced at USENIX on July 14, 1983. The initial development was based on Bourne shell source code.

What is set in ksh?

On Unix-like operating systems, the set command is a built-in function of the Bourne shell (sh), C shell (csh), and Korn shell (ksh), which is used to define and determine the values of the system environment.


3 Answers

Did you do man ksh?

You want to do a set -o multiline.

Excerpt from man ksh:

multiline:

The built-in editors will use multiple lines on the screen for lines that are longer than the width of the screen. This may not work for all terminals.

like image 107
tzot Avatar answered Oct 16 '22 10:10

tzot


eval $(resize) should do it.

like image 44
Boune Avatar answered Oct 16 '22 09:10

Boune


If possible, try to break the command down to multiple lines by adding \ ie:

$ mycommand -a foo \
  -f bar \
  -c dif
like image 37
Achille Avatar answered Oct 16 '22 11:10

Achille