ksh/.kshrc.d/30-marks.ksh (view raw)
1export MARKPATH=$HOME/.marks
2
3function mark {
4 mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$1"
5}
6
7function unmark {
8 rm -i "$MARKPATH/"$(basename $PWD)""
9}
10
11function marks {
12 for f in "$MARKPATH"/*; do
13 printf '%s → %s\n' "$(basename "$f")" "$(readlink "$f")"
14 done
15}
16
17function j {
18 cd -P "$MARKPATH/$1" 2>/dev/null || printf '%s\n' "error: no such mark $1"
19}