🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #597

Bash-1.03 and exported PATH and history substitutions

#597
From: Brian Fox
Date: Fri, 15 Sep 1989 16:07
69 lines
3644 bytes
   Date: Thu, 14 Sep 89 19:05:36 +1000
   From: Gregory Bond <munnari!melba.bby.oz.au!gnb@uunet.uu.net>

   1) If you have a path line like
	   PATH=:/bin:/usr/bin:~/bin:/usr/local/bin

      then when it is exported, the ~ is not expanded.  This confuses
      subsequent invocations of /bin/sh or other programs that parse
      paths, for example make.  Csh does expand components of the path it
      exports.

Csh expands words beginning with whitespace.  It does not have to expand
the components of PATH, which are separated by colons.  I could special
case the PATH variable, which I think is ugly beyond belief. 

      This one annoys me a lot: you can't add slashes with ^.^./^ as

Yes, you can.  Please try again.  Also, please specify the version of
Bash (or better yet, readline) which is giving you the problem.  In that
way, people won't assume that the bug exists in all versions of Bash,
but perhaps only in the version that you have, or only on the hardware
that you have Bash compiled on.

      is treated as "!!:s/././/"
No, it is treated as "!!:s^.^./"

      ^x^xx^lly (or the equivalent ":s/x/xx/lly") doesn't do turn
      txt into txxtlly.

This is a bug.  However, I found that "!!:s/foo/bar/more text" changed
"hellofooness" into "hellobarnessmore text", which is what I believe it
is supposed to do.  So perhaps the problem only exists in quick
substitution, with the `^' character.  (5 minutes pass) Okay, I fixed
it.  Patches for :g and for the substitution fix follow.  These patches
apply to bash 1.03's history.c file.

      Some serious rewrite of the history editing code would need to be
      done to make bash csh-compatible in this area.

Actually, I am of the opinion that a serious rewrite of Csh would be
required to give it the line editing features of Bash.  In the course of
writing this letter I have added "!:gs/foo/bar", so I would not suppose
that a "serious" rewrite is neccessary.

      Is this a desired end, or is there some other model of history
      editing bash is trying to emulate?

I provided Csh style history substitution as a bonus, and as a quick
hack.  I thought that people who had been used to using Csh would
appreciate a little flavor of home, even though all of the history
functions could be performed interactively, with the readline editing
features.  I had hoped that any time I spent working on the command line
interface would be to enhance readline, so that features missing from my
quick history hack could be better performed in the Emacs idiom.

I do not expect to spend any substantial amount of time hacking on the
arcane and non-intuitive Csh !-style history interface.  I have already
spent too much time as it is.
  I have started looking at

      these problems and may eventually produce a better history editor.

If you produce a better history editor, which is clean, and provides the
same interface as mine, I will be more than happy to make it a part of
the Readline library.  Perhaps next time, you can spend the half hour
adding the features that you want instead of me!

Brian Fox
Technical Details
Message-ID: <8909151607.AA26698@aurel.caltech.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox
References: <8909140905.AA04621@baby.bby.oz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox
From: bfox@AUREL.CALTECH.EDU (Brian Fox)
Newsgroups: gnu.bash.bug
Subject: Bash-1.03 and exported PATH and history substitutions
Message-ID: <8909151607.AA26698@aurel.caltech.edu>
Date: 15 Sep 89 16:07:19 GMT
References: <8909140905.AA04621@baby.bby.oz>
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: bfox@aurel.caltech.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 69