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

Revision 23782, 1.2 KB checked in by broder, 16 years ago (diff)
In dotfiles: * Implement setup for bash. (Trac: #104)
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."
21                echo "Contact the locker maintainer for more information."
22            fi
23            # Do minimal environment setup
24            add $setup_filsys
25
26        fi
27else
28        echo ""
29        echo "The $SUBJECT filesystem could not be attached."
30        filsys=(`hesinfo $SUBJECT filsys`)
31        if [ ${#filsys} -lt 3 ]; then
32                echo "Check your spelling of the filesystem name."
33        else
34                echo -n "The ${filsys[0]} fileserver"
35                if [ ${filsys[0]} != "AFS" ]; then
36                    echo -n " named ${filsys[2]}"
37                fi
38                echo " may be down."
39        fi
40        if [ -n "$XSESSION" ]; then
41            echo "Type exit to get rid of this window."
42        else
43            kill -HUP $$        # cause shell to exit
44        fi
45fi
46unset SUBJECT   # to prevent infinite loops
Note: See TracBrowser for help on using the repository browser.