ksh: hash (#) at beginning of a line exits the shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ksh: hash (#) at beginning of a line exits the shell
# 1  
Old 03-06-2012
Network ksh: hash (#) at beginning of a line exits the shell

This is WILD! Smilie

Under Ubuntu (where I am cross-posting this problem) I have lately noticed by terminal windows/tabs closing unexpectedly. I finally caught it: I was composing a complicated command so I practices it a few times commented out - that is, with a # at the start of the line. What is now happening is as follows:
  • If I start the line with #<white-space> i.e. a space or tab following the #, the shell abruptly exits.
  • If I start with the # and a letter, say l, it traces down my history for all old commands that started with l. When I add a letter to that - e.g. s, the list is pared down to all old commands [in my history] that had started with ls. As soon as my typed comment becomes fails to match anything in my history, it exits.
  • If there are any command lines in my history that did start with blanks (I've been experimenting) it pops those up, paring the list as I type characters, until it hits something not in my history. Then it exits. This is essentially the same as my point above.
This appears to be a bizarre setting or option in my history; that the hash activates a history search.

I don't want it! What is it and how do I turn it off? Smilie

The version I'm using is "Version JM 93u 2011-02-08".

This does not happen with bash; the first time I have found bash behaving better than ksh. Furthermore, after searching the ksh man page, it occurred to me to set -o emacs and try it. I still get the history search but it does not exit the shell upon confirmed mismatch.

Thanks for diagnosis/advice/help.
__________________
-- Rasputin Paskudniak II (In pursuit of undomesticated, semi-aquatic avians)
# 2  
Old 03-06-2012
This is a known bug fixed in the last ksh release (ksh93u+).

11-09-20 A bug with SHOPT_EDPREDICT when neither vi or emacs was enabled for lines beginning with # when in a multibyte locale has been fixed.
# 3  
Old 03-07-2012
Thank you, j.

I should have ended my initial post with "Don't tell me it's a bug!" Then I would have started this post with "I asked you not to tell me that." Smilie

Quote:
Originally Posted by jlliagre
This is a known bug fixed in the last ksh release (ksh93u+).

11-09-20 A bug with SHOPT_EDPREDICT when neither vi or emacs was enabled for lines beginning with # when in a multibyte locale has been fixed.
A bug?!! Imp-Possible! Smilie That is indeed disappointing.Smilie
HMM.. Perhaps there is some way to explicitly block this SHOPT_EDPREDICT option. Ubuntu's update manager is going to be a bit shy about including the 93u+ update all that fast.

OK, where can I download an installable package of ksh93-u+ for Debian/Ubuntu ?
__________________
-- Rasputin Paskudniak II (In pursuit of undomesticated, semi-aquatic avians)
# 4  
Old 03-07-2012
As far as I know, SHOPT_EDPREDICT is only a compile time option, not something you can disable at run time. To get ksh93u+ on ubuntu, I guess you need to compile from source.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

beginning less from line #

Hi from a script i want to to read a file beginning at line e.g. number 21 to the EOF. less +n21 temp.txt Bevor the result, it brings an empty page, so that i cant use for scripting. Any idea how the problem can be solved? Thanks in advance! IMPe (2 Replies)
Discussion started by: IMPe
2 Replies

2. Shell Programming and Scripting

comment a line of the patterns is a the beginning of the line

I need to comment the lines starting with pattern "exclude" or "exclude=". If the work exclude comes at any other part, ignore it. Also, ignore, excludes, excluded etc. Ie only comment the line starting with exclude. File contents. exclude exclude= hi I am excluded excludes excludes= ... (9 Replies)
Discussion started by: anil510
9 Replies

3. UNIX for Dummies Questions & Answers

vim copy line and paste at the beginning, middle, and end of another line

How would you do vim copy line and paste at the beginning, middle, and end of another line. I know yy copies the whole line and p pastes the whole line, but on its own separate line. Sometimes I would like to copy a line to the beginning, middle, or end of another line. I would think this would be... (3 Replies)
Discussion started by: cokedude
3 Replies

4. UNIX for Dummies Questions & Answers

How to specify beginning-of-line/end-of-line characters inside a regex range

How can I specify special meaning characters like ^ or $ inside a regex range. e.g Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character. I tried the following but it does not work: sed 's/\(\)/<do something here>/g' file1 ... (3 Replies)
Discussion started by: jawsnnn
3 Replies

5. Shell Programming and Scripting

Space at beginning of the line

How can I delete spaces at the begining of all lines of my file ? (2 Replies)
Discussion started by: Sara_84
2 Replies

6. Shell Programming and Scripting

add a number to the beginning of every line

hey, i would like to add a line number to the beginning like so: red blue green yellow will be: 1=>red 2=>blue 3=>green 4=>yellowplease advise thank u. (5 Replies)
Discussion started by: boaz733
5 Replies

7. Shell Programming and Scripting

Shell scripts exits after executing ypmatch

Hello - I have a script which creates a NIS user on Solaris machine. Before creating the user I check if the user being created laready exists or not using ypmatch and use $? to get the exit code. If a user exists, I get 0, works fine. However when the user is not found, the shell scripts exits by... (1 Reply)
Discussion started by: manju--
1 Replies

8. Shell Programming and Scripting

Exits from putty instead of shell script

Dear, I have written below code to initiate the log at top of my script. #Set the log file LOGFILE=<path>/<filename.log> exec > $LOGFILE 2>&1 ............... .... ... .. ............ echo -e "\n\n Script finished OK " `date "+%m/%d/%y %H:%M:%S" ` "\n\n" exit 0 the logging ends only... (14 Replies)
Discussion started by: Imran_Chennai
14 Replies

9. Shell Programming and Scripting

String hash/obfuscation in ksh

I have a vendor that needs to install a set of scripts (written in korn) that will be run as root through crontab every day. This set of scripts will need to ssh as root to other servers without getting challenged for user name or password. So I have set up ssh key pairing and authorized_keys... (2 Replies)
Discussion started by: StHalcyon
2 Replies

10. Shell Programming and Scripting

Unix Script with line number at beginning of each line.

Could anybody help me. I need to create a script that reads a text file from STDIN and prints out the file to STDOUT with line numbers at the beginning of each line. Thanks. (5 Replies)
Discussion started by: mascorro
5 Replies
Login or Register to Ask a Question