Created
November 21, 2017 14:54
-
-
Save mrpossoms/127e0ed677eff650c0e2db614592a423 to your computer and use it in GitHub Desktop.
Run this script in the background to remember your last working directory. Useful for ssh sessions when working in deep directory structures.
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/zsh | |
shell_pid=$PPID | |
last_link=$(readlink -f /proc/$shell_pid/cwd) | |
while true; do | |
link=$(readlink -f /proc/$shell_pid/cwd) | |
if [ $link==$last_link ]; then | |
readlink -f /proc/$PPID/cwd/ > ~/.hole | |
last_link=$link | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment