Created
October 31, 2025 15:43
-
-
Save lindacmsheard/f5122c42a7dc566a813902da2e901a2e to your computer and use it in GitHub Desktop.
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
| alias c='cd $HOME/cmd' | |
| alias h='cd $HOME' | |
| alias viba='vi $HOME/.bash_aliases' | |
| alias ..='cd ..' | |
| alias ...='cd ../..' | |
| # cdh history function (via fex.belwue.de/fstools/bash.html) | |
| declare -a DIRS | |
| savedir() { | |
| local i | |
| for ((i=1;i<=9;i++)); do | |
| test "$1" = "${DIRS[$i]}" && return | |
| done | |
| for ((i=9;i>1;i--)); do | |
| DIRS[$i]="${DIRS[((i-1))]}" | |
| done | |
| DIRS[1]="$1" | |
| } | |
| showdirs() { | |
| local i=1 | |
| while [ "${DIRS[$i]}" ]; do | |
| echo "$i: ${DIRS[$i]}" | |
| ((i++)) | |
| done | |
| } | |
| gotodir() { | |
| local d | |
| showdirs | |
| printf "goto: " | |
| read -n 1 d | |
| echo | |
| cd "${DIRS[$d]}" | |
| } | |
| PROMPT_COMMAND=prompt_command | |
| prompt_command() { savedir "$OLDPWD"; } | |
| alias cdh=gotodir | |
| 3,8 Top |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment