[gnu.bash.bug] readline enhancement request

anantha%ravi@Sun.COM (Anantha Srirama) (01/10/90)

I have been using bash (1.04) for a couple of months and am happy with its
performance.  I was a Korner before I was a Basher :-) for the sake of history
and it explains the following as well:

	- When KSH is in EMACS editing mode one can yank the last argument of
	  the previous command, a la !$ in BASH or CSH, and insert it in the
	  present command line.  This is done physically, meaning the last
	  argument of the previous command line appears when you type <ESC>_
	  This is a nice feature which is notably absent in bash-1.04.  Bash
	  naively assumes that the only things one wants to do with the last
	  argument of the previous command is to reuse it, which is not the
	  case many times.  Many a times I yank this argument and tweek it.

	- KSH provides a wide array of utilities to manipulate the value of
	  variables as follows:

		${param#pattern}   -> remove small left pattern from 'param'
		${param##pattern}  -> remove large left pattern from 'param'
		${param%pattern}   -> remove small right pattern from 'param'
		${param%%pattern}  -> remove large right pattern from 'param'

	  These are very useful utilities that I use a lot in shell scripts
	  which rename, unshar... a group of files

	  ksh$ for i in part?.Z
	  ksh> do
	  ksh>	   uncompress $i > ${i%.Z}
	  ksh> done

	  The above script in KSH puts all the uncompressed files in 'part?'
	  I don't know how one would do it in bash-1.04??

If any of this can be done bash, then can somebody please tell me how.  If not
the implementor (Brian Fox are you listening :->) might want spend a few minutes
thinking about this.  Thanks for a great FREE shell.

	-Anantha-

*******************************************************************************
Anantha Padmanabha N. Srirama		|  USENET:  ...sun!anantha@Eng
Sun Microsystems			|  ARPA:    anantha@Eng.Sun.COM
2550, Garcia Ave.  MS: 16-02		|
Mt. View,  CA-94043			|
*******************************************************************************

chet@cwns1.CWRU.EDU (Chet Ramey) (01/11/90)

In article <130059@sun.Eng.Sun.COM> anantha%ravi@Sun.COM (Anantha Srirama) writes:

	- When KSH is in EMACS editing mode one can yank the last argument of
	  the previous command, a la !$ in BASH or CSH, and insert it in the
	  present command line.  This is done physically, meaning the last
	  argument of the previous command line appears when you type <ESC>_
	  This is a nice feature which is notably absent in bash-1.04.  Bash
	  naively assumes that the only things one wants to do with the last
	  argument of the previous command is to reuse it, which is not the
	  case many times.  Many a times I yank this argument and tweek it.

I have implemented this; it's an easy hack in bashline.c.  I have sent it to
Anantha in a separate message.

	- KSH provides a wide array of utilities to manipulate the value of
	  variables as follows:

		${param#pattern}   -> remove small left pattern from 'param'
		${param##pattern}  -> remove large left pattern from 'param'
		${param%pattern}   -> remove small right pattern from 'param'
		${param%%pattern}  -> remove large right pattern from 'param'

I have done this as well.  I *just* sent the code to Brian for testing
(like this morning), and it should appear in the next release. 

	  These are very useful utilities that I use a lot in shell scripts
	  which rename, unshar... a group of files

	  ksh$ for i in part?.Z
	  ksh> do
	  ksh>	   uncompress $i > ${i%.Z}
	  ksh> done

	  The above script in KSH puts all the uncompressed files in 'part?'
	  I don't know how one would do it in bash-1.04??

for i in part?.Z
do
	stem=$(basename $i .Z)
	uncompress $i > $stem
done

Chet Ramey
-- 
Chet Ramey
Network Services Group				"Help! Help! I'm being
Case Western Reserve University			 repressed!"
chet@ins.CWRU.Edu