[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

3062.0. "Help with "Alias"" by HPSCAD::GATULIS (Frank Gatulis) Tue Oct 31 1989 09:59

    
    Could someone tell me why this happens:
    ---------------------------------------
    In my shell-startup I define the following alias
    
          Alias end endcli   (or endshell, I've tried both)
    
    when I run the shell, I get no complaints but the "end" alias
    did not take.  It doesn't show up in the alias list.

    Another curiosity ... 
    If I'm actually in the shell and I type the identical alias
    command that I used in the shell-startup. It takes.
    
    After doing some experiments, I realize that I can use almost
    any alias for endshell, except "end".
    
    What the heck am I missing here.
    
    Thanks,
    Frank
    
T.RTitleUserPersonal
Name
DateLines
3062.1Shot in the darkTLE::RMEYERSRandy MeyersTue Oct 31 1989 10:286
Re: .0

A random guess here:

Is the Alias end endcli the last line of your shell-startup?  Does
that line end with a newline?
3062.2Reboot?DICKNS::MACDONALDWA1OMM 7.093/145.05/223.58 AX.25Tue Oct 31 1989 10:3712
>>    In my shell-startup I define the following alias
    
>>          Alias end endcli   (or endshell, I've tried both)
    
>>    when I run the shell, I get no complaints but the "end" alias
>>    did not take.  It doesn't show up in the alias list.


Did you reboot after modifying your shell-startup file?

-Paul    

3062.3TLE::RMEYERSRandy MeyersTue Oct 31 1989 10:526
Re: .2

>Did you reboot after modifying your shell-startup file?

There's no need to reboot.  Any new shell reads the shell-startup from
s: when it starts up.
3062.4.re .1 .2HPSCAD::GATULISFrank GatulisTue Oct 31 1989 10:5516
    .re .1
    
    No Randy, the alias was somewhere in the middle of others.
    
    .re .2
    
    It so happend I did reboot but that was coincidence.  Why in the
    world would I have to reboot anyway?
    
    
    A thought!
    Maybe there's something there that's case sensitive!  Don't know
    but I've been burned by that before.  I'll try more experiments.
    
    Thanks
    
3062.5Do you have an <e> alias also ?KETJE::VLASIUTry with a bigger hammerTue Oct 31 1989 10:579
    Ref. .0
    Hello,
    I'm using "alias end endcli" (endshell is an alias for endcli I think)
    and it works fine but at a moment I remember I had problems with alias.
    I had a Xaaa alias and I have also introduced an X alias. My Xaaa
    disapeard from the alias list. So if you have an "e" for edit after the
    "end" alias it may be the same case.
    Regards,
    Sorin
3062.6ORDER OF ALIASES IS IMPORTANTPOLAR::GOSLINGTue Oct 31 1989 11:2925
       .5 is on the right track.  The order that you place 'like' aliases
       (an alias name which is a subset of another alias name) is
       important.
       
       I had the same problem described in .0 with a bunch of PRINT
       aliases.  If I did this (syntax may not be exact):
       
       alias printwide dh0:utilities/print [] cpi16
       alias print     dh0:utilities/print [] cpi10
       
       One of the aliases wouldn't 'take' (don't remember which).
       
       If I reversed them, i.e.
       
       alias print     dh0:utilities/print [] cpi10
       alias printwide dh0:utilities/print [] cpi16

       They both 'took'.
       
       Sorry, but I can't remember if it was the PRINT or PRINTWIDE that
       wouldn't take in the first example.  Regardless, reversing the
       order worked.
              
       Art
       
3062.7And the answer is ....HPSCAD::GATULISFrank Gatulis 297-6770Tue Oct 31 1989 20:3759
    
    Well I did some experiments and believe I've emperically discovered
    the algorithm for the way alias commands are inserted in the active
    list when read from the shell-startup.   I don't know why its's
    like this, but it is, and I think it's a bug.
    
    See if I can explain .... Logically - the following happens
    
    Each time a new alias command is read from shell-start up it is
    added to the existing list and then a hokey algorithm is applied
    to see if the new command should cause a previous one to be dumped.
    The algorithm matches the text of most recent command against the
    text of the previous commands (in the same order they were read
    in).  Here are the rules of this silly game:
    
    1.  If the text of the most recent command is contained in ONLY
        ONE previous command, the earlier command is dumped.
    
    2.  If the text of the most recent command is contained in MORE
        THAN ONE of the previous commands,  ONE (AND ONLY ONE) of the
        previous commands will be dumped: 
          - If the previous commands are of UNEQUAL LENGTHS, the
            shortest one is dumped.
          - If the previous commands are of EQUAL LENGTHS, the one
            alphabetically closest to the most recent command is 
            dumped.
    

    Simple as that ..... Here's an example of a list of alias cmds
    contained in shell-startup and what remains after the algorithm:
    
    Sample List       Result
    ------------      ------
    alias extent ...   alias alpha ...
    alias editor ...   alias e ...
    alias alpha  ...   alias end ...
    alias end ...      alias ex ...
    alias ex ...
    alias ed ...
    alias e ...
    
Heres why ....
    1. first problem encountered when "ex" is read in.  "ex" found in
       "extent" so "extent" is dumped.
    2. next problem - "ed" found in "editor" so "editor" is dumped.
    3. finally "e" is found in "end, ex, ed" and "ed" is dumped.
       "ed, ex" become candidates for dumping and "ed" is closer
       alphabetically to "e".
    
    What's the point?  Knowing this, it's simple to order your alias
    commands so they ALL work as expected.  Seems as if simply ordering
    the list by length of command is fullproof.
    
 Thanks to everyone for putting me on the right track.  It's simpler than
 it looks and I hope it clears up confusion for other folks.

    Frank