Add -s alias to --save-cwd and check its argument.
[rover.git] / rover.sh
blob33b4107fc6cf5c50dbb20b86f65566d4f5fe77f6
1 #!/bin/sh
3 # Based on ranger launcher.
5 # Usage: ". ./rover.sh [/path/to/rover]"
7 tempfile="$(mktemp)"
8 rover="${1:-rover}"
9 test -z "$1" || shift
10 "$rover" --save-cwd "$tempfile" "${@:-$(pwd)}"
11 returnvalue=$?
12 test -f "$tempfile" &&
13 if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
14 cd "$(cat "$tempfile")"
16 rm -f -- "$tempfile"
17 return $returnvalue