-
-
Save goodell/8061570 to your computer and use it in GitHub Desktop.
A version that deals with the empty line at the end so that it doesn't spew the result of a bare "export". It also splits on newlines instead of commas, so embedded commas in the envvar value won't be misinterpreted.
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
# adapted from https://gist.github.com/simonjbeaumont/4672606 | |
function tmup() { | |
local IFS | |
echo -n "Updating to latest tmux environment..."; | |
export IFS=$'\n'; | |
for line in $(tmux showenv -t $(tmux display -p "#S")); | |
do | |
if [[ "$line" == -* ]]; then | |
unset $(echo $line | cut -c2-); | |
elif [[ -n "$line" ]] ; then | |
export "$line"; | |
fi | |
done | |
echo "Done" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment