[gnu.bash.bug] Some minor bash nits/wouldlikes

gnb@melba.bby.oz.au (Gregory Bond) (09/01/89)

Coming from a (SunOS 3.5) csh environment, there are a few things I'd
really like to see in bash:

For history, a few inconsistancies:
There is no :gs operator for replacing on the whole line.
e.g.
	% echo hello hello
	hello hello
	% !!:gs/ll/xdr/
	echo hexdro hexdro
	hexdro hexdro
And the existing :s operator doesn't do delimiter-escaping or
&-expanding.
e.g.
	% echo qweryuiop
	qweryuiop
	% !!:s/qwer/&t
	echo qwertyuiop
	qwertyuiop
	% echo hello/world 
	hello/world
	% !!:s/llo\/wo/ll0\/wo/
	echo hell0/world
	hell0/world

Fixing this would require some rewrite of the :s processing in
history.c.  I am intending to look at this at some point soon.  Is
there some philosophical reason why this is a bad idea (e.g. a
decision that the csh history mechanism is in some sense flawed)?

2)  When starting window tools in the background, they inherit the tty
state from bash and use that for the command window.  (The tool I
notice this from is Sun's dbxtool).  This leaves the dbxtool command
window in cbreak/noecho mode.  Most annoying.  And you can't start it
in foreground and then ^Z it as dbxtool ignores ^z.  Dammit.

I guess this is in general impossible to ensure, because you can never
tell when the background task has read the tty state and thus it is
safe to reset it.  Just put it down to broken dbxtool.  Should be
documented pretty clearly in the eventual manual.

3) Sun csh does completion on ~u<ESC> for usernames.  A useful feature
I may add one day.

4) Sun csh, when given a "cd dir1" will try current dir, then cdpath,
then a shell/environment variable called "dir1".  I've found this
really usefull for working on multiple versions of the one source: a
command can set shell variables for make, etc, and vars for src, run,
lib etc. Then "cd run" changes to the correct run directory.  Again,
should be easy to add.  The sun version didn't know about paths, so
perhaps you could make "cd dir1/dir2" equivalent to "cd $dir1/dir2".


Greg.

bfox@AUREL.CALTECH.EDU (Brian Fox) (09/01/89)

I will be placing 1.03 on prep.ai.mit.edu today.

   Date: Fri, 01 Sep 89 16:22:08 +1000
   From: Gregory Bond <munnari!melba.bby.oz.au!gnb@uunet.uu.net>

   Coming from a (SunOS 3.5) csh environment, there are a few things I'd
   really like to see in bash:

   For history, a few inconsistancies:
   There is no :gs operator for replacing on the whole line.
   e.g.
	   % echo hello hello
	   hello hello
	   % !!:gs/ll/xdr/
	   echo hexdro hexdro
	   hexdro hexdro

That is right, I didn't write a `g'lobal operator.  I may add one in the
future.

   And the existing :s operator doesn't do delimiter-escaping or
   &-expanding.
   e.g.
	   % echo qweryuiop
	   qweryuiop
	   % !!:s/qwer/&t
	   echo qwertyuiop
	   qwertyuiop

THe ampersand is replaced by the matched text?  What if you are just
adding an ampersand, which seems to me to be a common case:

	bash$ hairy-function argument
	bash$ !!:s/argument/another-argument &	<- user wants to background this job.

	   % echo hello/world 
	   hello/world
	   % !!:s/llo\/wo/ll0\/wo/
	   echo hell0/world
	   hell0/world

I didn't do delimiter escaping.  However, the first character following
the `:s' is the delimiter, so you can choose it when typing in the
substitution request.  For example:

	!!:s@llo/wo@ll0/wo

would do what you wanted.


   2)  When starting window tools in the background, they inherit the tty
   state from bash and use that for the command window.  (The tool I
   notice this from is Sun's dbxtool).  This leaves the dbxtool command
   window in cbreak/noecho mode.  Most annoying.  And you can't start it
   in foreground and then ^Z it as dbxtool ignores ^z.  Dammit.

I have fixed this (to the best of my knowledge) in 1.03.

   3) Sun csh does completion on ~u<ESC> for usernames.  A useful feature
   I may add one day.

It is in 1.03.

   4) Sun csh, when given a "cd dir1" will try current dir, then cdpath,
   then a shell/environment variable called "dir1".  I've found this
   really usefull for working on multiple versions of the one source: a
   command can set shell variables for make, etc, and vars for src, run,
   lib etc. Then "cd run" changes to the correct run directory.  Again,
   should be easy to add.  The sun version didn't know about paths, so
   perhaps you could make "cd dir1/dir2" equivalent to "cd $dir1/dir2".

New variable in 1.03. "cdable_dirs", if it exists, says to do exactly
that with arguments to pushd and cd.

Brian

cudcv@warwick.ac.uk (Rob McMahon) (09/02/89)

In article <8909011533.AA11301@aurel.caltech.edu> bfox@aurel.caltech.edu writes:
>THe ampersand is replaced by the matched text?  What if you are just adding
>an ampersand, which seems to me to be a common case:
>
>	bash$ hairy-function argument
>	bash$ !!:s/argument/another-argument &	<- user wants to background this job.

	bash$ !!:s/argument/another-argument/ &
or
	bash$ !!:s/argument/another-argument \&
or even
	bash$ !!:s/argument/another-&/ &
:-)

This is very useful sometimes for small additions to long replacements.

Rob
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England

bfox@AUREL.CALTECH.EDU (Brian Fox) (09/02/89)

   Date: 2 Sep 89 12:45:18 GMT
   From: mcsun!ukc!warwick!cudcv@uunet.uu.net  (Rob McMahon)
   Organization: Computing Services, Warwick University, UK
   References: <8909010622.AA04478@baby.bby.oz>, <8909011533.AA11301@aurel.caltech.edu>
   Sender: bug-bash-request@prep.ai.mit.edu

   In article <8909011533.AA11301@aurel.caltech.edu> bfox@aurel.caltech.edu writes:
   >THe ampersand is replaced by the matched text?  What if you are just adding
   >an ampersand, which seems to me to be a common case:
   >
   >	bash$ hairy-function argument
   >	bash$ !!:s/argument/another-argument &	<- user wants to background this job.

	   bash$ !!:s/argument/another-argument/ &
   or
	   bash$ !!:s/argument/another-argument \&
   or even
	   bash$ !!:s/argument/another-&/ &
   :-)

   This is very useful sometimes for small additions to long replacements.

How about:

bash$ hairy-function argument
bash$ ^ar^another-ar^ &

Brian

cudcv@warwick.ac.uk (Rob McMahon) (09/04/89)

In article <8909021449.AA14827@aurel.caltech.edu> bfox@aurel.caltech.edu writes:
|   >	bash$ hairy-function argument
|   >	bash$ !!:s/argument/another-argument &	<- user wants to background this job.
|
|	   bash$ !!:s/argument/another-argument/ &
|   or
|	   bash$ !!:s/argument/another-argument \&
|   or even
|	   bash$ !!:s/argument/another-&/ &
|   :-)
|
|   This is very useful sometimes for small additions to long replacements.
|
|How about:
|
|bash$ hairy-function argument
|bash$ ^ar^another-ar^ &

Fine, unless `hairy-function' was `ar xov /var/tmp/libarc.a' ... You may need
to type a lot to ensure uniqueness.  I know that in bash you can just use ^P
and edit it, but sometimes the ^...^... form is more convenient, especially if
it is a command which takes a fair time to complete, so that you can type this
in while you're waiting.

Rob
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England