




NAME: startup -- Automatic program/command execution during login

DOCUMENTATION AUTHOR:  John Bruner



DESCRIPTION:

   The startup facility in Unix allows automatic execution at login time
of a preset command file.

   Before an intelligent discussion of creating a startup  file  can  be
made,  a  few  words need to be said about Unix shell files.  One of the
features of the Unix system is that whenever a set of commands are to be
used often, they can be placed in a file and can be executed by a single
command.  For instance, suppose that you wish to know at several  points
what time it is and who is logged in.  Each time you could type the com-
mands:

date            [print date and time]
who             [give names of users logged-in]

   It would be much easier, however to type only one command  each  time
you wanted this information.  To do this, you would merely create a file
containing these commands, say file "stats".

   Once you have put the commands you want executed in a file, you  must
tell Unix that this file can be executed.  Thus, you may type:

chmod 0705 stats

Now you are all set.  Whenever you want to find out  the  time  and  the
users logged in, you merely need to type:

stats

and the time and users logged in will be automatically printed for you!

   The startup facility in Unix operates in the above manner.  You mere-
ly  create a file containing commands which you wish to be executed when
you log on to Unix.  The name of this special file should be  ".startup"
(notice the period preceeding the name).

   Now, each time you log in, the system will find the  file  ".startup"
and will execute all of the commands in it.



EXAMPLES

   Suppose that you wished to use the character "%" to backspace instead
of the character "#".  You could just type the command:

stty erase %

every time you login.  It would be easier for you, however, if the  com-
puter would automatically change the backspace character to "%" for you.
To do this, create the file ".startup" containing:

stty erase %

Now, each time you log on, the  computer  will  automatically  set  your
backspace character to "%".

   As a slightly more involved idea, suppose that you wished to have the
following options set:  (1) backspace character "%", (2) upper-case out-
put, (3) list of your directory, (4)  list  of  other  users  logged-on.
This could be very easily accomplished by:

stty erase %                    [Set backspace character to "%"]
stty upper                      [All output in upper case]
ls -l                           [Detailed directory index]
who                             [List of users logged-on]

Place these commands in the file ".startup".  Each time you log in,  the
desired actions will be taken.


SEE ALSO:
sh (I) Unix For Beginners

KNOWN BUGS:
