Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
export-prepend ()
{
eval "export $1=\"$2:\$$1\""
}
fhs-extend ()
{
local python_version=3;
while [[ $# -gt 0 ]]; do
case $1 in
-h | --help)
echo "env-extend [--python-version <VERSION>] <PREFIX>";
return
;;
--python-version)
python_version=$1;
shift
;;
*)
break
;;
esac;
done;
local prefix=${1%/};
export-prepend PYTHONPATH $prefix/lib:$prefix/lib/python${python_version}/dist-packages:$prefix/lib/python${python_version}/site-packages;
export-prepend PATH $prefix/bin;
export-prepend LD_LIBRARY_PATH $prefix/lib;
export-prepend PKG_CONFIG_PATH $prefix/lib/pkgconfig:$prefix/share/pkgconfig;
echo "[ FHS Environment extended: ${prefix} ]";
export-prepend MANPATH $prefix/share/man
}
# Use this to run things in a pristine environment.
alias bash-isolate='env -i HOME=$HOME DISPLAY=$DISPLAY SHELL=$SHELL TERM=$TERM USER=$USER PATH=/usr/local/bin:/usr/bin:/bin bash --norc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment