-
-
Save simonjbeaumont/4672606 to your computer and use it in GitHub Desktop.
Update bash to latest tmux environment on reattaching.
This file contains hidden or 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
#!/bin/bash | |
tmup () | |
{ | |
echo -n "Updating to latest tmux environment..."; | |
export IFS=","; | |
for line in $(tmux showenv -t $(tmux display -p "#S") | tr "\n" ","); | |
do | |
if [[ $line == -* ]]; then | |
unset $(echo $line | cut -c2-); | |
else | |
export $line; | |
fi; | |
done; | |
unset IFS; | |
echo "Done" | |
} |
showenv has a -s
option now to format the output as bourne shell commands, so I think eval $(tmux showenv -s ...)
should do the job of this script now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice little script, I changed IFS to $'\n' and removed the tr. No need to export IFS either.