Skip to content

Instantly share code, notes, and snippets.

@StudioEtrange
Created May 9, 2020 00:24
Show Gist options
  • Save StudioEtrange/da223edba28a49076187bcefde5d87fa to your computer and use it in GitHub Desktop.
Save StudioEtrange/da223edba28a49076187bcefde5d87fa to your computer and use it in GitHub Desktop.
Bash env manipulation
# launch a shell with an empty env
# https://unix.stackexchange.com/a/291913
env -i bash --noprofile --norc
# source var file and show a specific var
env -i bash --noprofile --norc -c ". somefile.sh; echo $VAR;"
# backup/restore env
# https://unix.stackexchange.com/questions/284382/export-save-and-import-source-shell-variables
declare -p > backup.env
. backup.env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment