[net.micro.cpm] ZCPR3 Intro - Message 7: Aliases

RCONN@SIMTEL20.ARPA (03/28/84)

From:  Rick Conn <RCONN@SIMTEL20.ARPA>


                         ZCPR3 - Aliases

               Aliases  are COM files created by  the  ALIAS 
         command  which  contain one or more  command  lines 
         which  are  invoked when the Alias name  is  typed.  
         Parameter  passing into the command lines within an 
         Alias  is supported in a manner similar to  command 
         file parameter passing.   Aliases are convenient to 
         create  command scripts which are used  repeatedly, 
         and the special commands,  such as STARTUP (used on 
         cold boot to run a series of programs to initialize 
         the system), are created as Aliases.


B1:WORK2>NOTE you have to be a WHEEL to create ALIASes
B1:WORK2>wheel /s
WHEEL, Version 3.0
 Wheel Password?  Wheel Byte is ON

B1:WORK2>NOTE a number of parameters and some information can be determined
B1:WORK2>NOTE   and expanded by an alias
B1:WORK2>alias
ALIAS, Version 1.0

 Input Alias (RETURN to Abort)
 --> echo The name of this Alias is $0;      <-- I ended these
echo The current DU is $d$u:;                <-- lines with ^E
echo and the first 4 parameters are:;
echo $1 $2 $3 $4
 Name of ALIAS Command (RETURN to Abort)? cmdstat
 Alias Created

B1:WORK2>NOTE the alias is a very short file (under 2K)
B1:WORK2>dir cmdstat.com
 CMDSTAT .COM    2 
            B1:WORK2 --     1 Files Using     2K (  292K Left)

B1:WORK2>cmdstat

THE NAME OF THIS ALIAS IS CMDSTAT
THE CURRENT DU IS B1:
AND THE FIRST 4 PARAMETERS ARE:

B1:WORK2>cmdstat this is a very short demo

THE NAME OF THIS ALIAS IS CMDSTAT
THE CURRENT DU IS B1:
AND THE FIRST 4 PARAMETERS ARE:
THIS IS A VERY

B1:WORK2>cmdstat hello, world

THE NAME OF THIS ALIAS IS CMDSTAT
THE CURRENT DU IS B1:
AND THE FIRST 4 PARAMETERS ARE:
HELLO, WORLD  

B1:WORK2>NOTE aliases are convenient for a number of things --
B1:WORK2>NOTE   they are intended primarily to replace tedious command
B1:WORK2>NOTE   sequences with a simple command
B1:WORK2>alias
ALIAS, Version 1.0

 Input Alias (RETURN to Abort)
 --> dir $1;era $1 i;dir $1
 Name of ALIAS Command (RETURN to Abort)? exera
 Alias Created

B1:WORK2>NOTE I now have an ALIAS which displays a directory of selected
B1:WORK2>NOTE   files, allows me to erase them with inspection, and then
B1:WORK2>NOTE   displays the same directory again to let me see the
B1:WORK2>NOTE   results
B1:WORK2>dir
 CMDSTAT .COM    2 | DEMO    .TXT    2 | DEMO    .ZEX    2 | DEMO1   .TXT    2 
 DEMO2   .TXT    2 | DEMO3   .TXT    2 | EXERA   .COM    2 | RHEX    .COM    2r
 RHEX2   .COM    2r
            B1:WORK2 --     9 Files Using    18K (  284K Left)


               The following runs an Alias:

B1:WORK2>exera demo?.txt

 DEMO    .TXT    2 | DEMO1   .TXT    2 | DEMO2   .TXT    2 | DEMO3   .TXT    2 
             B1:WORK2 --     4 Files Using     8K (  284K Left)
 DEMO    .TXT - Erase (Y/N)? n
 DEMO1   .TXT - Erase (Y/N)? y
 DEMO2   .TXT - Erase (Y/N)? y
 DEMO3   .TXT - Erase (Y/N)? n
 DEMO    .TXT    2 | DEMO3   .TXT    2 
            B1:WORK2 --     2 Files Using     4K (  288K Left)

B1:WORK2>exera demo3.txt

 DEMO3   .TXT    2 
            B1:WORK2 --     1 Files Using     2K (  288K Left)
 DEMO3   .TXT - Erase (Y/N)? y
            B1:WORK2 --     0 Files Using     0K (  290K Left)

B1:WORK2>NOTE also, since IFs are everywhere, they can be used in aliases:
B1:WORK2>alias
ALIAS, Version 1.0

 Input Alias (RETURN to Abort)
 --> if exist $1;type $1 p;fi
 Name of ALIAS Command (RETURN to Abort)? typeit
 Alias Created

B1:WORK2>typeit demo.txt

 IF T

This is a test
This is only a test

 To No IF 

B1:WORK2>cp demo1.txt=demo.txt
 Done

B1:WORK2>dir demo?.txt
 DEMO    .TXT    2 | DEMO1   .TXT    2 
            B1:WORK2 --     2 Files Using     4K (  286K Left)

B1:WORK2>typeit demo?.txt

 IF T

This is a test
This is only a test

 Typing  DEMO    .TXT -  

This is a test
This is only a test

 To No IF 

B1:WORK2>typeit nofile.txt

 IF F
 To No IF 

B1:WORK2>NOTE or I can expand TYPEIT to be better
B1:WORK2>alias typeit
ALIAS, Version 1.0
 Alias Name: TYPEIT  
 Old Alias Command Line:
  1 --> IF EXIST $1;
  2 --> TYPE $1 P;
  3 --> FI

 Input Alias (RETURN to Abort)
 --> if exist $1;type $1 p;else;echo file $1 not found;fi
 File TYPEIT  .COM Exists - Overwrite (Y/N)? Y

 Alias Created

B1:WORK2>typeit demo.txt

 IF T

This is a test
This is only a test

 IF F
 To No IF 

B1:WORK2>typeit nofile.txt

 IF F
 IF T
FILE NOFILE.TXT NOT FOUND
 To No IF 

-------