Created
September 24, 2018 12:20
-
-
Save mccurdyc/c7e3c5c10aeed5e05eda3feff1f4d3e7 to your computer and use it in GitHub Desktop.
Open New Terminal Window to Last Working Directory
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
# original author: https://www.reddit.com/r/i3wm/comments/6ugxvk/set_working_directory_for_terminal/dlsntaw | |
# Open new terminal in same directory as last terminal: | |
function cd { | |
builtin cd $@ | |
pwd > ~/.last_dir | |
} | |
# clobber "file exists" warning | |
# clobber is toggled off below | |
setopt clobber | |
# Open new terminal in same directory as last terminal: | |
if [ -f ~/.last_dir ]; then | |
cd "`cat ~/.last_dir`" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment