summary refs log tree commit diff stats
path: root/examples
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-18 01:21:16 +0100
committerhut <hut@lavabit.com>2013-02-18 01:21:16 +0100
commit740d1e5fd20525f2ac2c6b6af493b0c21d2e845e (patch)
tree58bb68e0ba333c39bc40bb1e1e130c3dbd056f59 /examples
parent95bca173ce92294f31c052555b78938626f3c120 (diff)
parent2b3110fcfe4ecfeec120c700eb7b7ddb85c4fc40 (diff)
downloadranger-740d1e5fd20525f2ac2c6b6af493b0c21d2e845e.tar.gz
Merge branch 'master' into vcs
Conflicts:
	doc/ranger.1
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/rifle_sxiv.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/rifle_sxiv.sh b/examples/rifle_sxiv.sh
index efa935b2..0cbda01e 100755
--- a/examples/rifle_sxiv.sh
+++ b/examples/rifle_sxiv.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # This script searches image files in a directory, opens them all with sxiv
 # and sets the first argument to the first image displayed by sxiv.
@@ -11,12 +11,19 @@
 #
 
 [ "$1" == '--' ] && shift
-target="$(realpath -s "$1")"
+
+function abspath {
+    case "$1" in
+        /*) printf "%s\n" "$1";;
+        *)  printf "%s\n" "$PWD/$1";;
+    esac
+}
 function listfiles {
     find -L "$(dirname "$target")" -maxdepth 1 -type f -iregex \
       '.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
 }
 
+target="$(abspath $1)"
 count="$(listfiles | grep -m 1 -Zznx "$target" | cut -d: -f1)"
 
 if [ -n "$count" ]; then