etc/setenv/sh

30 lines
593 B
Text
Raw Permalink Normal View History

2020-11-04 02:03:20 +03:00
# To include in any rc to set up the environment by files.
if test -n "$rpath" ; then
export SETENV="$rpath/dot/setenv"
fi
setenv(){
2024-04-06 17:43:22 +03:00
if test -d "$ENVDIR" ; then
2020-11-04 02:03:20 +03:00
# The way to make system more flexible.
# Actually I'm really tired of editing one big file.
# It is really easier to change specific one with variables
# or modules.
# Set variables from files.
sh="$1"
for i in "$ENVDIR/$sh/var"/* ; do
2020-11-04 02:03:20 +03:00
if test -r "$i" ; then
export "`basename \"$i\"`"="`cat \"$i\"`"
fi
done
# Modules.
for i in "$ENVDIR/$sh/rc"/*; do
2020-11-04 02:03:20 +03:00
if test -r "$i" ; then
. "$i"
fi
done
fi
}