3 # enter - set up project-specific environment
5 # @(#) enter.sh 1.5 11/4/89 15:56:03
12 : ${HOME?} ${SHELL=/bin/sh} make sure these are
set
17 echo "Usage: ${0} project" 1>&2; exit 1
20 test -r ${HOME}/.
${1} ||
{
21 echo "${0}: can't read environment file: '${HOME}/.${1}'" 1>&2; exit 1
25 echo "${0}: can't execute command shell: '${SHELL}'" 1>&2; exit 1
28 # set up default Bourne-shell prompt
30 export PS1
; PS1
="$1%${PS1- }"
36 # define UPPER and lower-case environment variables with the project name
38 _PNAME_
=`echo ${1} | case \`echo -n\
` in # assume $1 lower case
39 "") tr a-z A-Z;; # this is for V7, BSD
40 *) tr '[a-z]' '[A-Z]';; # and this is for SYSV
42 eval ${1}=\${${_PNAME_}=\${${1}}}
44 eval test "X\${${1}}" != X ||
{
45 echo "${0}: ${HOME}/.${1} should set '${1}' or '${_PNAME_}'" 1>&2; exit 1
48 export ${1} MANPATH PATH
${_PNAME_}
52 echo "Entering project '${1}' - leave with 'exit' or 'control-d'" 1>&2
56 echo "project ${1} NOT entered" 1>&2; exit 1;
62 # set up a project-specific environment
69 # The \fIenter\fR command sets up an environment that makes
70 # it easy to access \fIproject\fR-specific programs and files.
72 # \fIenter\fP consults a file with environment information
73 # ($HOME/.\fIproject\fR, Bourne-shell syntax) and invokes
74 # a new command shell of the same type as the login shell.
75 # Typically, project environment files are maintained and
76 # given out by the project administrator.
78 # In order to leave the project environment use the \fIexit\fP
79 # command or type a control-d;
80 # the details may depend on the type of login shell involved.
82 # As a minimum, the environment file should set an environment
83 # variable with the same name as the \fIproject\fP. The variable
84 # name can be either be identical to \fIproject\fP or in upper case.
85 # For consistency, \fIenter\fP will set both variables to the same value.
90 # all files pertaining to a project \fIfoobar\fR are located under the
91 # directory \fI/usr/foo/bar/foobar\fR. For example, there
93 # \fI/usr/foo/bar/foobar/man\fR with manual pages,
94 # \fI/usr/foo/bar/foobar/bin\fR with executable
95 # programs, other directories for object libraries and include files,
98 # In order to enter a project \fIfoobar\fR, the command
105 # consults a file \fI.foobar\fR (in the user\'s home directory)
111 # export FOOBAR; FOOBAR=/usr/foo/bar/foobar
112 # export PATH; PATH=$PATH:$FOOBAR/bin
113 # export MANPATH; MANPATH=$MANPATH:$FOOBAR/man
117 # The second line automatically makes all project-specific
118 # executable programs accessible. The third line makes it possible
119 # to use the standard UNIX \fIman\fR command for retrieval of
120 # project-specific manual pages. The \fIenter\fR command
121 # makes sure that both the \fIfoobar\fR and \fIFOOBAR\fR
122 # environment variables are set to the same value.
124 # sh(1), echo(1), test(1), tr(1), login shell
126 # $HOME/.\fIproject\fR
127 # ENVIRONMENT VARIABLES
129 # HOME, login directory
130 # PATH, search path for commands
131 # MANPATH, search path for the \fIman\fR command.
133 # Name clashes may occur if people have entered several projects
134 # at the same time. This can be avoided by using unique project names,
135 # which is a good idea anyway.
138 # Eindhoven University of Technology
139 # Department of Mathematics and Computer Science
140 # Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
142 # Tue Apr 19 15:35:41 MET DST 1988
144 # enter.sh 1.5 11/4/89 15:56:03 (draft)