Last active
October 19, 2022 11:00
-
-
Save EricCousineau-TRI/6870970d68f75d23061177a52932a5d1 to your computer and use it in GitHub Desktop.
bash_helpers_functions - env-isolate, bash-isolate, fhs-extend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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