diff options
Diffstat (limited to 'examples/rifle_sxiv.sh')
-rwxr-xr-x | examples/rifle_sxiv.sh | 14 |
1 files changed, 14 insertions, 0 deletions
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_$$" |