20 lines
404 B
Bash
20 lines
404 B
Bash
|
if test $OS = "Windows_NT" ; then
|
||
|
lf() {
|
||
|
winpty lf
|
||
|
}
|
||
|
fi
|
||
|
lfcd () {
|
||
|
tmp="$(mktemp)"
|
||
|
# `command` is needed in case `lfcd` is aliased to `lf`
|
||
|
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
|
||
|
}
|