manager/config/bash/bashrc.d/lf

17 lines
301 B
Text
Raw Normal View History

2022-04-18 00:14:34 +01:00
#!/bin/bash
lf () {
tmp="$(mktemp)"
command lf --last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi
}