home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 7.9 Show Subshell Level with $SHLVL Chapter 7
Setting Your Shell Prompt
Next: 7.11 dirs in Your Prompt: Better than $cwd
 

7.10 What Good Is a Blank Shell Prompt?

[This tip is also great if you use a mouse to copy and paste command lines in your window.]

Some terminals I've used (like old Hewlett-Packard and Tektronix terminals) had local editing. You could move your cursor up the screen to a previous command line, maybe make some edits to it, then press a SEND LINE key to resend that line to the host. This didn't have anything to do with sophisticated command-line editing (11.13 ) like some UNIX shells have now. Maybe your terminal can do that, too.

The problem was that unless I erased the shell prompt (% ) on my screen, it would be sent back to the shell and give the error "% : Command not found." So I set my shell prompt to this:

set prompt='     '

That's right: four spaces. Most UNIX commands start their output at column 1, so my command lines were easy to find because they were indented. And the shell didn't care if I sent four spaces before the command line. So everything was fine until I got my new terminal without a SEND LINE key...

(If you want some information in your prompt, too, make a multiline prompt (7.5 ) with four spaces in the last line.)

- JP


Previous: 7.9 Show Subshell Level with $SHLVL UNIX Power Tools Next: 7.11 dirs in Your Prompt: Better than $cwd
7.9 Show Subshell Level with $SHLVL Book Index 7.11 dirs in Your Prompt: Better than $cwd

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System