[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:
parent
5464fe3e4a
commit
a7a69890b8
@ -18,8 +18,14 @@ mark() {
|
||||
else
|
||||
MARK="$1"
|
||||
fi
|
||||
if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
|
||||
mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK"
|
||||
link="$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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user