summary refs log tree commit diff stats
path: root/examples
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-18 00:41:36 +0100
committerhut <hut@lavabit.com>2013-02-18 00:41:50 +0100
commitbaf1bafa5c90b856c690b33ff74bc0fec344ae1c (patch)
treebf15697f94edc80f4470f5af2a0d442c0f077dc8 /examples
parentfb24f4a8ca6475ce2966298a5753ee01d8628e6b (diff)
downloadranger-baf1bafa5c90b856c690b33ff74bc0fec344ae1c.tar.gz
examples/rifle_sxiv.sh: removed realpath dependency
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/rifle_sxiv.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/rifle_sxiv.sh b/examples/rifle_sxiv.sh
index 542aa604..0cbda01e 100755
--- a/examples/rifle_sxiv.sh
+++ b/examples/rifle_sxiv.sh
@@ -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