[jump] ask user if existing mark should be overriden

`mark` did not worked if the mark was already used.
But sometimes I want to change a previously set mark.
`mark` now simple asks, when an existing mark is detected and
overrides it, if the user agrees.
This commit is contained in:
berleon 2016-01-19 14:22:28 +01:00
parent 5464fe3e4a
commit a7a69890b8

View File

@ -18,8 +18,14 @@ mark() {
else else
MARK="$1" MARK="$1"
fi fi
if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then link="$MARKPATH/$MARK"
mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK" if [ -e "$link" ]; then
if read -q \?"Override mark ${MARK} to $(readlink $link) with $PWD? (y/n) "; then
rm -f "$link"
ln -s "$PWD" "$link"
fi
elif read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
mkdir -p "$MARKPATH"; ln -s "$PWD" "$link"
fi fi
} }