Subject: | |
From: | |
Reply To: | |
Date: | Sun, 2 Apr 1995 00:44:55 GMT |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
David Greer mentioned that /etc/profile contains:
: > export PS1='shell/iX> '
and went on to suggest a better version...but one that still
contains a ">" in it.
Ahh...something that Gavin and I got bit on recently...
I no longer have a ">" in my prompt for a very practical reason:
It's dangerous!
Let's say your prompt is "foo>", and your current working directory
is /bin , and you want to run a program that happens to reside
in /bin (say, /bin/ls), and you start to type:
foo> ls blah
(i.e., you were prompted with "foo>", and you type "ls blah"...but no
<return> yet)
Now, you accidentally hit the HP "<enter>" key (no, *not* the <return>
key ... the "transmit this line" key!!!!!)
What does the computer see by the time it gets the <return> at the
end if the "transmit this line"? simple:
ls blahfoo> ls blah
-------
^ ------------
| ^
| \<---- sent by the <enter> key (along with a <return> at end)
|
\<---- typed by the user
What does the shell do? it opens "ls" as the output file for your
command, because of the @#$%^ ">" in the line!
Poof! You've just lost the "ls" program.
(assuming you had the ability to write onto that file)
Been there, done that :(
On Unix (HP-UX and AIX) I now use:
PS1='($HOSTNAME$LVL) $PWD: '
and my .kshrc file (I use ksh) has in it:
let LVL=LVL+1
In this manner, my prompt tells me:
1) name of computer I am on;
2) depth of "ksh" nesting. (a "ksh" or a simple "su" re-invokes
.kshrc each time, thereby incrementing the nesting counter...
a poor-mans simulation of HPCIDEPTH)
3) my current working directory
4) and *no* ">" !
--
Stan Sieler
[log in to unmask]
|
|
|