source: trunk/debathena/debathena/dotfiles/env_setup.bash @ 24863

Revision 24863, 1.3 KB checked in by jdreed, 12 years ago (diff)
In dotfiles: * Be a bit clearer when .attachrc exists but .attachrc.bash doesn't
Line 
1# Prototype file for setting up course-specific environment
2
3echo "Attaching $SUBJECT ... "
4setup_dir=`/bin/attach -p $SUBJECT`
5
6if [ $? == 0 ]; then
7
8        # Record information to remove setup later
9        setup_filsys=$SUBJECT
10
11        # Set prompt to reflect changed environment
12        PS1="${SUBJECT}\$ "
13
14        if [ -r $setup_dir/.attachrc.bash ]; then
15                unset SUBJECT   # to prevent infinite loops
16                echo "Running commands in $setup_dir/.attachrc.bash ... "
17                source $setup_dir/.attachrc.bash
18        else
19            if [ -r $setup_dir/.attachrc ]; then
20                echo "This locker is not yet configured for the 'setup' command with the bash shell."
21                echo "(.attachrc.bash not readable).  Please contact the locker maintainer."
22                echo "For more information, see http://debathena.mit.edu/setup.bash"
23            fi
24            # Do minimal environment setup
25            add $setup_filsys
26
27        fi
28else
29        echo ""
30        echo "The $SUBJECT filesystem could not be attached."
31        filsys=(`hesinfo $SUBJECT filsys`)
32        if [ ${#filsys} -lt 3 ]; then
33                echo "Check your spelling of the filesystem name."
34        else
35                echo -n "The ${filsys[0]} fileserver"
36                if [ ${filsys[0]} != "AFS" ]; then
37                    echo -n " named ${filsys[2]}"
38                fi
39                echo " may be down."
40        fi
41        if [ -n "$XSESSION" ]; then
42            echo "Type exit to get rid of this window."
43        else
44            kill -HUP $$        # cause shell to exit
45        fi
46fi
47unset SUBJECT   # to prevent infinite loops
Note: See TracBrowser for help on using the repository browser.