Skip to content

Instantly share code, notes, and snippets.

@EricCousineau-TRI
Last active October 19, 2022 11:00
Show Gist options
  • Save EricCousineau-TRI/6870970d68f75d23061177a52932a5d1 to your computer and use it in GitHub Desktop.
Save EricCousineau-TRI/6870970d68f75d23061177a52932a5d1 to your computer and use it in GitHub Desktop.
bash_helpers_functions - env-isolate, bash-isolate, fhs-extend
# Use this to run things in a pristine environment.
alias env-isolate='env -i HOME=$HOME DISPLAY=$DISPLAY SHELL=$SHELL TERM=$TERM USER=$USER PATH=/usr/sbin:/usr/bin:/bin'
alias bash-isolate='env-isolate bash --norc'
export-prepend ()
{
eval "export $1=\"$2:\$$1\""
}
fhs-extend ()
{
local python_version=3;
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment