From d728452b0ffdb56de3ae642b848477a48f290740 Mon Sep 17 00:00:00 2001 From: NRK Date: Sun, 19 Sep 2021 01:30:12 +0600 Subject: add more detailed implementation note --- examples/rifle_sxiv.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/examples/rifle_sxiv.sh b/examples/rifle_sxiv.sh index 35c65da9..f65524a8 100755 --- a/examples/rifle_sxiv.sh +++ b/examples/rifle_sxiv.sh @@ -14,6 +14,20 @@ # shell syntax and calls being made to external utilities, such as grep or find. # This makes it portable across many unix like systems, although it may not be # the cleanest or fastest approach. +# +# First, using case statement to get absolute path is quicker than calling +# 'realpath' because it would fork a whole process, which is slow. +# +# Second, we need to append a file list to sxiv, which can only be done +# properly in three ways: arrays (which are not POSIX) or \0 sperated strings. +# Unfortunately, assigning \0 to a variable is not POSIX either (will not work +# in dash and others), so we cannot store the result of listfiles to a +# variable. +# +# The third approach is to store the result to a tmpfile and using `-i` to feed +# the list to sxiv. This is the fastest approach since we won't have to call +# listfiles twice. + tmp="/tmp/sxiv_rifle_$$" -- cgit 1.4.1-2-gfad0