Skip to content

Instantly share code, notes, and snippets.

@kfox
Created September 9, 2022 15:17
Show Gist options
  • Save kfox/f1abf828f232c4c39919e705a4420102 to your computer and use it in GitHub Desktop.
Save kfox/f1abf828f232c4c39919e705a4420102 to your computer and use it in GitHub Desktop.
Apply environment variables to your current shell context, useful for when you SSH into a server and need your user to operate in the same context as a service already running as that user, e.g. Celery, etc.
eval $(xargs -0 -L1 -a /proc/1/environ | grep -E '^[A-Z].*' | sed -e 's/=/="/' -e 's/$/"/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment