Hi Guys,
Just got hit with this one, resulting in the automatic NULL'ing of a script, and thought I'd pass it on.
Have had my prompt set to the following for years with no problem till now.
export PS1="`whoami`@`hostname`:"'$PWD> '
I also use ksh Command history via set -o vi.
I was trying to recall the past execution command of a script I was working on. The command history was a little muddled (due to multiple sessions), so I Ctrl-c'd and tried to call it up again.
This time I got two prompts together and then the command.
Thinking that the <CR> had just not displayed for some reason I hit Return .... with the horrible result of null'ing the script I was working on.
I figure that the timing of my Ctrl-c must somehow have stuffed the PS1 cmd exec, resulting in my prompt being inserted as a command that can be interpreted by ksh.
This situation seems to need the following to cause an issue.
1. PS1 ending in >
2. Command History in use (set -o vi).
3. Use of Ctrl-c within Command History Selection.
Needless to say after loosing about 200 lines of complex code amendments, I have now changed my PS1 prompt to end in ":" :-(
Here's the screen dump of the situation.
user1@host1:/home/user1/projects/ops> ./ops_ctrl -dio
user1@host1:/home/user1/projects/ops> r
user1@host1:/home/user1/projects/ops> dio
user1@host1:/home/user1/projects/ops> ksh: dio: not found
user1@host1:/home/user1/projects/ops> user1@host1:/home/user1/projects/ops> ops_ctrl -r
ksh: user1@host1:/home/user1/projects/ops: not found
user1@host1:/home/user1/projects/ops>
user1@host1:/home/user1/projects/ops> ops_ctrl -r
user1@host1:/home/user1/projects/ops> echo $?
0
user1@host1:/home/user1/projects/ops> ops_ctrl -dr
user1@host1:/home/user1/projects/ops> ls -alt
total 16
-rwxr-x--- 1 user1 staff 0 29 Aug 13:05 ops_ctrl
drwxr-x--- 2 user1 staff 512 27 Aug 11:09 .
drwxr-x--- 6 user1 staff 512 22 Aug 14:08 ..
user1@host1:/home/user1/projects/ops> history
529 ./ops_ctrl -dio
530 dio
531 user1@host1:/home/user1/projects/ops> ops_ctrl -r
532 ops_ctrl -r
533 echo $?
534 ops_ctrl -dr
535 ls -alt
536 history
Dont get caught.
Best Regards to ALL, Peter.
Just got hit with this one, resulting in the automatic NULL'ing of a script, and thought I'd pass it on.
Have had my prompt set to the following for years with no problem till now.
export PS1="`whoami`@`hostname`:"'$PWD> '
I also use ksh Command history via set -o vi.
I was trying to recall the past execution command of a script I was working on. The command history was a little muddled (due to multiple sessions), so I Ctrl-c'd and tried to call it up again.
This time I got two prompts together and then the command.
Thinking that the <CR> had just not displayed for some reason I hit Return .... with the horrible result of null'ing the script I was working on.
I figure that the timing of my Ctrl-c must somehow have stuffed the PS1 cmd exec, resulting in my prompt being inserted as a command that can be interpreted by ksh.
This situation seems to need the following to cause an issue.
1. PS1 ending in >
2. Command History in use (set -o vi).
3. Use of Ctrl-c within Command History Selection.
Needless to say after loosing about 200 lines of complex code amendments, I have now changed my PS1 prompt to end in ":" :-(
Here's the screen dump of the situation.
user1@host1:/home/user1/projects/ops> ./ops_ctrl -dio
user1@host1:/home/user1/projects/ops> r
user1@host1:/home/user1/projects/ops> dio
user1@host1:/home/user1/projects/ops> ksh: dio: not found
user1@host1:/home/user1/projects/ops> user1@host1:/home/user1/projects/ops> ops_ctrl -r
ksh: user1@host1:/home/user1/projects/ops: not found
user1@host1:/home/user1/projects/ops>
user1@host1:/home/user1/projects/ops> ops_ctrl -r
user1@host1:/home/user1/projects/ops> echo $?
0
user1@host1:/home/user1/projects/ops> ops_ctrl -dr
user1@host1:/home/user1/projects/ops> ls -alt
total 16
-rwxr-x--- 1 user1 staff 0 29 Aug 13:05 ops_ctrl
drwxr-x--- 2 user1 staff 512 27 Aug 11:09 .
drwxr-x--- 6 user1 staff 512 22 Aug 14:08 ..
user1@host1:/home/user1/projects/ops> history
529 ./ops_ctrl -dio
530 dio
531 user1@host1:/home/user1/projects/ops> ops_ctrl -r
532 ops_ctrl -r
533 echo $?
534 ops_ctrl -dr
535 ls -alt
536 history
Dont get caught.
Best Regards to ALL, Peter.