Last active
October 15, 2021 23:59
-
-
Save lelandbatey/71e3f720f72dc67b4360 to your computer and use it in GitHub Desktop.
In place cd; cd won't create a newline and prompt
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
# Original | |
# function cd { command cd $@ > /dev/null; echo -ne "\r\e[1A\e[J"; } | |
# Written by Kate Adams: https://github.com/KateAdams | |
function cd { | |
command cd $1 > /dev/null # pipe stdout, but not stderr | |
local ret=$? | |
if [[ $ret == 0 ]]; then | |
# \r = return to start of line | |
# \e[1A = move cursor up a line | |
# \e[J = clear everything after the cursor | |
echo -ne "\r\e[1A\e[J" | |
fi | |
return $ret | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment