[comp.sys.apollo] Aliases For Aegis Commands

turner@dover.sps.mot.com (Robert Turner) (07/28/89)

First I know this is a wimpy question, but what the heck.  I'm
an old Aegis kind of guy slowing migrating to BSD on SR10+.
What I'm looking for is a set of aliases for some of the more
common Aegis commands, e.g. cpf, dlf, dlt, crd, crl, wd, etc.
My fingers keep typing Aegis commands while my brain is saying
BSD, BSD, BSD!

Yes I know it would be a good learning exercise to create them
myself, but being a good and lazy programmer I'd like to steal
from someone else.

Any suggestions?

Robert

-- 
Robert Turner (602) 994-6837 ...!uunet!dover!turner or turner@dover.sps.mot.com
Horngren's Observation:
	Among economists, the real world is often a special case.

GBOPOLY1@NUSVM.BITNET (fclim) (07/29/89)

In article <1632@dover.sps.mot.com>, turner%dover%oakhill%cs.utexas
   .edu.uucp@tut.cis.ohio-state.edu  (Robert Turner)

> First I know this is a wimpy question, but what the heck.  I'm
> an old Aegis kind of guy slowing migrating to BSD on SR10+.
> What I'm looking for is a set of aliases for some of the more
> common Aegis commands, e.g. cpf, dlf, dlt, crd, crl, wd, etc.
> My fingers keep typing Aegis commands while my brain is saying
> BSD, BSD, BSD!
>
> Yes I know it would be a good learning exercise to create them
> myself, but being a good and lazy programmer I'd like to steal
> from someone else.
>
> Any suggestions?
>
> Robert

I have setup my path to include /com in my ~/.cshrc :
     set path = (.... /com)
This way, I do not need aliases for Aegis commands.
However because cd is built-in to csh and wd is built-in to /com/sh
at SR10+ (hmm, wonder if there is a /com/wd), I have to
     alias wd 'cd !*'
Futhermore, because ld (in /bin) is homonymous with /com/ld, I have
     alias ld 'ls !*'
Note you could use
     alias ld '/com/ld !*'
However, my ls has an alias of
     alias ls 'ls -AF !*'
which tells whether an object is a sub-dir, executable file, FIFO,
symbolic links or just a plain file.

Another pair of homonymous commands is help (/usr/bin/help for SCCS and
/com/help).  Sometimes, I need help on ACLs, so I need to type in
     help protection rights
To get the right "help", I have the alias
     alias help '/com/help !*'

If you are worried that you do not have the security of cpf, mvf, chn,
etc, use
     alias cp 'cp -i !*'
     alias mv 'mv -i !*'
     alias rm 'rm -i !*'
This will not copy files over existing ones.

Hope this helps.

fclim          --- gbopoly1 % nusvm.bitnet @ cunyvm.cuny.edu
computer centre
singapore polytechnic
dover road
singapore 0513.

GBOPOLY1@NUSVM.BITNET (fclim) (07/29/89)

Here's another alias for csh.  It implements the Korn shell feature
of cd-ing to the previous working directory :
       % pwd
       foo
       % cd bar ; pwd
       bar
       % cd - ; pwd
       foo
       % cd - ; pwd
       bar

I'm not sure if the 4.3BSD csh has this feature, but it's
certainly not available on 4.2BSD (SR9.7).  Anyway, you need to
add this to your ~/.cshrc
       set prev = ~
as well as the alias
       alias cd
           set tmp = $cwd;
           if (!* == -) cd $prev;
           if (!* != -) cd !*;
           set prev = $tmp;
           unset tmp

Please note that I have split the alias into several lines to show
the structure.  But you have to put them on a single line; it won't
work if the alias is over several lines.  It's a kludge which I
don't know how to get round  (just look at the ulgy double
comparisons of !* with -).
       alias cd 'set tmp = $cwd; if (!* == -) ... $tmp; unset tmp'

BTW, a good book to invest in is
       The Unix C Shell Field Guide
       Gail and Paul Anderson
       Prentice-Hall
       ISBN 0-13-937468-X    025
Look up the gt and gb aliases in section 6.3 on page 125-126.

Here's a interesting feature that you'll not find using /com/sh.
We all know how useful ` (back-quote) is; especially for sys_admin
personnel.
       $ wd `node_data
will put you into the /sys/node_data directory of the node you
are working on.  However, if you need to go into the node_data dir
of a different node, you have to give the full pathname starting
from the network root :
       $ wd //london/sys/node_data

This is what I did to maintain my reputation for laziness.  Firstly,
I did this (only once)
       % mkdir ~/nd ; cd ~/nd
       % foreach x (//*)
       ?    ln -s $x/sys/node_data $x:t
       ? end

Thus, I now have ~/nd/london as a link to //london/sys/node_data.
Next, I put in my ~/.cshrc
       set cdpath = (~/nd)
(See the Andersons' book on the concept of cdpath which is also
available on Bourne and Korn Shells.)

Now, I am set up for life.  No matter where I am, if I want to get
to //london/sys/node_data, I just type in
       % cd london
This feature also works with pushd :
       % pushd london
will get me to london while keeping a record of where I have been.

fclim          --- gbopoly1 % nusvm.bitnet @ cunyvm.cuny.edu
computer centre
singapore polytechnic
dover road
singapore 0513.

steve@simon.UUCP (Steven E. Piette) (07/31/89)

In article <8907290144.AA22809@umix.cc.umich.edu>, GBOPOLY1@NUSVM.BITNET (fclim) writes:
> In article <1632@dover.sps.mot.com>, turner%dover%oakhill%cs.utexas
>    .edu.uucp@tut.cis.ohio-state.edu  (Robert Turner)
> 
> > What I'm looking for is a set of aliases for some of the more
> > common Aegis commands.
> > 
> > Robert
> 
> However because cd is built-in to csh and wd is built-in to /com/sh
> at SR10+ (hmm, wonder if there is a /com/wd), I have to
>      alias wd 'cd !*'
> 
> fclim          --- gbopoly1 % nusvm.bitnet @ cunyvm.cuny.edu

In fact there used to be a /com/wd under AEGIS before SR10.

At SR10 AEGIS processes changed to the UNIX single program per process model.
An external wd command would have forked a process from the shell, changed
the working directory in the new process space, and then exited back to the
shell where the old working dir is still set. This is exactly what happened
at prior OS releases when you were in a UNIX enviroment and used "WD" instead
of the shell intrinsic "CD" to move the directory pointer. 

Many old AEGIS people use to take advantage of the fact that a program could
change the enviroment of the parent. Not that this was a good practice, but it
had lots of uses once I found out the rules had changed from other systems I
had worked on.
-- 
Steven E. Piette                              Applied Computer Technology Inc.
UUCP: {smarthost}!simon!steve                             1750 Riverwood Drive
INET: steve@simon.CHI.IL.US or spiette@SUN.COM             Algonquin, IL 60102
-------------------------------------------------------------------------------

reesd@gtephx.UUCP (David Rees) (08/01/89)

In article <1632@dover.sps.mot.com>, turner@dover.sps.mot.com (Robert Turner) writes:
> First I know this is a wimpy question, but what the heck.  I'm
> an old Aegis kind of guy slowing migrating to BSD on SR10+.
> What I'm looking for is a set of aliases for some of the more
> common Aegis commands, e.g. cpf, dlf, dlt, crd, crl, wd, etc.
> My fingers keep typing Aegis commands while my brain is saying
> BSD, BSD, BSD!


First of all you must be carefull when making aliases for aegis to unix or
the other way around. For instance I tried to make an alias for cpf:
%alias cp cpf

This is WRONG! First of all cpf does all its copying in pairs while 
cp copies all the items to the last item.

$cpf F1 F2 F3 F4 
F1 -> F2    (F1 is copied to F2)
F3 -> F4    (F3 is copied to F4)

%cp F1 F2 F3 F4/
F1 F2 F3 -> F4 (They are copied into F4)

And second of all with the Unix shells (Bourne and C) the regular
expressions are expanded by the shell, while in Aegis it seems like
the expressions are expanded by the command. For instance I typed
the following:

%cpf ?*.c ./backup -r    <--- DON'T DO THIS!

While this is right out of the manual I missed a critical detail. The '%'
instead of the '$'. Since the C shell expanded the wildcard first, it sent
cpf a list of the files and then cpf proceeded to replace every other
file (about three weeks worth of work, thank god for backups). 

A rule I follow is, NEVER alias an AEGIS command as a Unix command 
(or the reverse). The two systems are just not that much alike. I would suggest
getting used to cp, rm -r (dlt) etc. 

In addition to the wild carding ect., the options go after instead of before. It would
be much easier for you to learn the Unix commands.


Here is a list of similar commands (I wouldn't alias them.....)
cpf     cp    (Not very similar)
dlf     rm
dlt     rm -r  (Recursive remove)
crd     mkdir
crl     ln -s  (Symbolic link, I think the target and source are switched in these)
wd      pwd

Perhaps you could make an alias that instead of performing the command, echos to you the
correct command to use. i.e.

%alias dlt 'echo Use rm'

                                 -David

BTW, I used the standard that a '$' prompt is an AEGIS shell and that a '%'
is an C (Unix) shell.

BTW2, are you no longer able to access AEGIS commands by giving the path (/com/cpf)
after SR10? I am still on SR9.7.