enter revision 1.1.1.1.4.2 1 1.1.1.1.4.2 matt #!/bin/sh
2 1.1.1.1.4.2 matt
3 1.1.1.1.4.2 matt # enter - set up project-specific environment
4 1.1.1.1.4.2 matt
5 1.1.1.1.4.2 matt # @(#) enter.sh 1.5 11/4/89 15:56:03
6 1.1.1.1.4.2 matt
7 1.1.1.1.4.2 matt # initialize
8 1.1.1.1.4.2 matt
9 1.1.1.1.4.2 matt IFS="
10 1.1.1.1.4.2 matt "
11 1.1.1.1.4.2 matt
12 1.1.1.1.4.2 matt : ${HOME?} ${SHELL=/bin/sh} make sure these are set
13 1.1.1.1.4.2 matt
14 1.1.1.1.4.2 matt # sanity checks...
15 1.1.1.1.4.2 matt
16 1.1.1.1.4.2 matt test $# = 1 || {
17 1.1.1.1.4.2 matt echo "Usage: ${0} project" 1>&2; exit 1
18 1.1.1.1.4.2 matt }
19 1.1.1.1.4.2 matt
20 1.1.1.1.4.2 matt test -r ${HOME}/.${1} || {
21 1.1.1.1.4.2 matt echo "${0}: can't read environment file: '${HOME}/.${1}'" 1>&2; exit 1
22 1.1.1.1.4.2 matt }
23 1.1.1.1.4.2 matt
24 1.1.1.1.4.2 matt test -x ${SHELL} || {
25 1.1.1.1.4.2 matt echo "${0}: can't execute command shell: '${SHELL}'" 1>&2; exit 1
26 1.1.1.1.4.2 matt }
27 1.1.1.1.4.2 matt
28 1.1.1.1.4.2 matt # set up default Bourne-shell prompt
29 1.1.1.1.4.2 matt
30 1.1.1.1.4.2 matt export PS1; PS1="$1%${PS1- }"
31 1.1.1.1.4.2 matt
32 1.1.1.1.4.2 matt # load environment
33 1.1.1.1.4.2 matt
34 1.1.1.1.4.2 matt . ${HOME}/.${1}
35 1.1.1.1.4.2 matt
36 1.1.1.1.4.2 matt # define UPPER and lower-case environment variables with the project name
37 1.1.1.1.4.2 matt
38 1.1.1.1.4.2 matt _PNAME_=`echo ${1} | case \`echo -n\` in # assume $1 lower case
39 1.1.1.1.4.2 matt "") tr a-z A-Z;; # this is for V7, BSD
40 1.1.1.1.4.2 matt *) tr '[a-z]' '[A-Z]';; # and this is for SYSV
41 1.1.1.1.4.2 matt esac`
42 1.1.1.1.4.2 matt eval ${1}=\${${_PNAME_}=\${${1}}}
43 1.1.1.1.4.2 matt
44 1.1.1.1.4.2 matt eval test "X\${${1}}" != X || {
45 1.1.1.1.4.2 matt echo "${0}: ${HOME}/.${1} should set '${1}' or '${_PNAME_}'" 1>&2; exit 1
46 1.1.1.1.4.2 matt }
47 1.1.1.1.4.2 matt
48 1.1.1.1.4.2 matt export ${1} MANPATH PATH ${_PNAME_}
49 1.1.1.1.4.2 matt
50 1.1.1.1.4.2 matt # become a new shell
51 1.1.1.1.4.2 matt
52 1.1.1.1.4.2 matt echo "Entering project '${1}' - leave with 'exit' or 'control-d'" 1>&2
53 1.1.1.1.4.2 matt
54 1.1.1.1.4.2 matt exec ${SHELL}
55 1.1.1.1.4.2 matt
56 1.1.1.1.4.2 matt echo "project ${1} NOT entered" 1>&2; exit 1;
57 1.1.1.1.4.2 matt
58 1.1.1.1.4.2 matt #++
59 1.1.1.1.4.2 matt # NAME
60 1.1.1.1.4.2 matt # enter 1
61 1.1.1.1.4.2 matt # SUMMARY
62 1.1.1.1.4.2 matt # set up a project-specific environment
63 1.1.1.1.4.2 matt # PROJECT
64 1.1.1.1.4.2 matt # sdetools
65 1.1.1.1.4.2 matt # SYNOPSIS
66 1.1.1.1.4.2 matt # enter project
67 1.1.1.1.4.2 matt # exit
68 1.1.1.1.4.2 matt # DESCRIPTION
69 1.1.1.1.4.2 matt # The \fIenter\fR command sets up an environment that makes
70 1.1.1.1.4.2 matt # it easy to access \fIproject\fR-specific programs and files.
71 1.1.1.1.4.2 matt #
72 1.1.1.1.4.2 matt # \fIenter\fP consults a file with environment information
73 1.1.1.1.4.2 matt # ($HOME/.\fIproject\fR, Bourne-shell syntax) and invokes
74 1.1.1.1.4.2 matt # a new command shell of the same type as the login shell.
75 1.1.1.1.4.2 matt # Typically, project environment files are maintained and
76 1.1.1.1.4.2 matt # given out by the project administrator.
77 1.1.1.1.4.2 matt #
78 1.1.1.1.4.2 matt # In order to leave the project environment use the \fIexit\fP
79 1.1.1.1.4.2 matt # command or type a control-d;
80 1.1.1.1.4.2 matt # the details may depend on the type of login shell involved.
81 1.1.1.1.4.2 matt #
82 1.1.1.1.4.2 matt # As a minimum, the environment file should set an environment
83 1.1.1.1.4.2 matt # variable with the same name as the \fIproject\fP. The variable
84 1.1.1.1.4.2 matt # name can be either be identical to \fIproject\fP or in upper case.
85 1.1.1.1.4.2 matt # For consistency, \fIenter\fP will set both variables to the same value.
86 1.1.1.1.4.2 matt # EXAMPLE
87 1.1.1.1.4.2 matt # .fi
88 1.1.1.1.4.2 matt # .ad
89 1.1.1.1.4.2 matt # In this example,
90 1.1.1.1.4.2 matt # all files pertaining to a project \fIfoobar\fR are located under the
91 1.1.1.1.4.2 matt # directory \fI/usr/foo/bar/foobar\fR. For example, there
92 1.1.1.1.4.2 matt # are subdirectories
93 1.1.1.1.4.2 matt # \fI/usr/foo/bar/foobar/man\fR with manual pages,
94 1.1.1.1.4.2 matt # \fI/usr/foo/bar/foobar/bin\fR with executable
95 1.1.1.1.4.2 matt # programs, other directories for object libraries and include files,
96 1.1.1.1.4.2 matt # and so on.
97 1.1.1.1.4.2 matt #
98 1.1.1.1.4.2 matt # In order to enter a project \fIfoobar\fR, the command
99 1.1.1.1.4.2 matt # .PP
100 1.1.1.1.4.2 matt # .ti +5
101 1.1.1.1.4.2 matt # .ft C
102 1.1.1.1.4.2 matt # enter foobar
103 1.1.1.1.4.2 matt # .ft
104 1.1.1.1.4.2 matt # .PP
105 1.1.1.1.4.2 matt # consults a file \fI.foobar\fR (in the user\'s home directory)
106 1.1.1.1.4.2 matt # with contents:
107 1.1.1.1.4.2 matt # .PP
108 1.1.1.1.4.2 matt # .ft C
109 1.1.1.1.4.2 matt # .nf
110 1.1.1.1.4.2 matt # .in +5
111 1.1.1.1.4.2 matt # export FOOBAR; FOOBAR=/usr/foo/bar/foobar
112 1.1.1.1.4.2 matt # export PATH; PATH=$PATH:$FOOBAR/bin
113 1.1.1.1.4.2 matt # export MANPATH; MANPATH=$MANPATH:$FOOBAR/man
114 1.1.1.1.4.2 matt # .ft
115 1.1.1.1.4.2 matt # .fi
116 1.1.1.1.4.2 matt # .PP
117 1.1.1.1.4.2 matt # The second line automatically makes all project-specific
118 1.1.1.1.4.2 matt # executable programs accessible. The third line makes it possible
119 1.1.1.1.4.2 matt # to use the standard UNIX \fIman\fR command for retrieval of
120 1.1.1.1.4.2 matt # project-specific manual pages. The \fIenter\fR command
121 1.1.1.1.4.2 matt # makes sure that both the \fIfoobar\fR and \fIFOOBAR\fR
122 1.1.1.1.4.2 matt # environment variables are set to the same value.
123 1.1.1.1.4.2 matt # COMMANDS
124 1.1.1.1.4.2 matt # sh(1), echo(1), test(1), tr(1), login shell
125 1.1.1.1.4.2 matt # FILES
126 1.1.1.1.4.2 matt # $HOME/.\fIproject\fR
127 1.1.1.1.4.2 matt # ENVIRONMENT VARIABLES
128 1.1.1.1.4.2 matt # SHELL, login shell
129 1.1.1.1.4.2 matt # HOME, login directory
130 1.1.1.1.4.2 matt # PATH, search path for commands
131 1.1.1.1.4.2 matt # MANPATH, search path for the \fIman\fR command.
132 1.1.1.1.4.2 matt # BUGS
133 1.1.1.1.4.2 matt # Name clashes may occur if people have entered several projects
134 1.1.1.1.4.2 matt # at the same time. This can be avoided by using unique project names,
135 1.1.1.1.4.2 matt # which is a good idea anyway.
136 1.1.1.1.4.2 matt # AUTHOR(S)
137 1.1.1.1.4.2 matt # W.Z. Venema
138 1.1.1.1.4.2 matt # Eindhoven University of Technology
139 1.1.1.1.4.2 matt # Department of Mathematics and Computer Science
140 1.1.1.1.4.2 matt # Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
141 1.1.1.1.4.2 matt # CREATION DATE
142 1.1.1.1.4.2 matt # Tue Apr 19 15:35:41 MET DST 1988
143 1.1.1.1.4.2 matt # STATUS
144 1.1.1.1.4.2 matt # enter.sh 1.5 11/4/89 15:56:03 (draft)
145 1.1.1.1.4.2 matt #--
146