🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #498

Re: [idallen@watcgl: bash aliases not transitive?!]

#498
From: Josh Siegel
Date: Wed, 23 Aug 1989 23:40
49 lines
2001 bytes
In article <8908232037.AA02389@aurel.caltech.edu> bfox@aurel.caltech.edu writes:
>
>   I think alias expansion should be transitive.  In the above example,
>   'a' should be expanded into 'date'.  In fact, that's what ksh does.  Is
>   there any reason why this behavior is not desirable?
>
>   Andy Wai
>
>You keep using the word 'transitive' when in actuality you want aliases
>to be expanded purely based on textual matches, irregardless of
>location.
>
>Am I making a correct assumption?
>
>Brian

No, he wants aliases to be expanded till either a count
is reached (alias loop) OR it no longer expands into anything
new.

alias_expand() can be modified to loop until no more expansions
are possible.  In this case, a modification to alias_expand would/could
be put it so that when a alias is used once, it is suppressed 
for that expansion.  This would prevent alias loops.

For example, the following would not result in a alias loop.

 alias ls=ls -CF

BUT:

  alias iheader='echo -n $si !* $ei'
  alias ih=iheader

  alias cd='cd \!*; header $hostname $PWD'
  alias pushd='pushd \!*; header $hostname $PWD'
  alias popd='popd \!*; header $hostname $PWD'
  alias suspend='suspend \!*; header $hostname $PWD'
  alias fg='fg \!*; header $hostname $PWD'
  alias pwd='pwd \!*; header $hostname $PWD'

Would work.

When do we get 1.03?

           --josh
-- 
Josh Siegel		(siegel@hc.dspo.gov)
  Friends don't let Friends eat Cherry Zingers
Technical Details
Message-ID: <404@topgun.dspo.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!topgun.dspo.gov!siegel
References: <8908231938.AA03422@watmath.waterloo.edu> <8908232037.AA02389@aurel.caltech.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!topgun.dspo.gov!siegel
From: siegel@DSPO.GOV (Josh Siegel)
Newsgroups: gnu.bash.bug
Subject: Re: [idallen@watcgl: bash aliases not transitive?!]
Message-ID: <404@topgun.dspo.gov>
Date: 23 Aug 89 23:40:27 GMT
References: <8908231938.AA03422@watmath.waterloo.edu> <8908232037.AA02389@aurel.caltech.edu>
Reply-To: siegel@topgun.dspo.gov (Josh Siegel)
Distribution: gnu
Organization: Los Alamos National Labs, MEE-10
Lines: 49