-
Notifications
You must be signed in to change notification settings - Fork 8
/
plt-alias.bash
31 lines (29 loc) · 880 Bytes
/
plt-alias.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Put this in .bashrc
function plt() {
BASEDIR=""
if [[ $# == 0 ]]; then
echo "PLTHOME = $PLTHOME"
elif [[ $# -ge 1 ]]; then
if [[ -d "$BASEDIR/$1" ]]; then
DIR=`cd "$BASEDIR/$1"; pwd -P`
shift
else
echo "ERROR: '$BASEDIR/$1' does not exist."
false
fi
if [[ $# == 0 ]]; then
export PLTHOME="$DIR"
export TEXINPUTS="$PLTHOME"/pkgs/slatex:
export MANPATH=$MANPATH:$PLTHOME/man
export PLTPLANETDIR="$PLTHOME"/add-on/planet
export PLTADDONDIR="$PLTHOME"/add-on
elif [[ $# -gt 0 ]]; then
(PLTHOME="$DIR"
TEXINPUTS="$PLTHOME"/pkgs/slatex:
MANPATH=$MANPATH:$PLTHOME/man
PLTPLANETDIR="$PLTHOME"/add-on/planet
PLTADDONDIR="$PLTHOME"/add-on
eval "$@")
fi
fi
}