[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature request for Bash
From: |
Bob Proulx |
Subject: |
Re: Feature request for Bash |
Date: |
Mon, 25 Nov 2013 17:09:53 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Ryan Campbell Cunningham wrote:
> I would like to request that Bash delete the character
> immediately preceding a '#', provided the '#'
> ...
> (The request was inspired by an article in the seventh
> edition of the UNIX Programmer's Manual. This feature
> is not required by POSIX, but came from the traditional
> Bourne shell.)
This isn't a feature of the shell but of the tty driver. It still
exists. It is still possible to use it today exactly as it was used
in Unix V7.
$ stty -a | grep --color erase
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
$ stty erase '#'
$ stty -a | grep --color erase
intr = ^C; quit = ^\; erase = #; kill = ^U; eof = ^D; eol = <undef>;
Feel free to try it.
You can also customize the behavior of your bash libreadline by
setting the backward-delete-char key binding. Place the following in
your $HOME/.inputrc file for example.
"#" backward-delete-char
> I would like to request that Bash delete the character
> immediately preceding a '#', provided the '#'
>
> * does not begin a new word,
> * is not included in any quoted string or variable,
> * is not preceded by a '\', and
> * is only found in an interactive command line (not
> in a script* or Bash initialization argument).
>
> An exception: If the character immediately preceding
> is also a '#', Bash should skip backward to the previous
> non-'#' character and delete as much characters as the
> number of consecutive '#' characters after them in the
> same word.
Oh my, isn't that a complicated set of rules! That is bound to cause
trouble. Not good. Plus that isn't how it worked in V7 days.
Bob