about summary refs log tree commit diff stats
path: root/examples
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2021-08-27 15:08:42 +0600
committerNRK <nrk@disroot.org>2021-08-27 15:08:42 +0600
commit51d3afc62142d2ead59173200f3d0b03a545a5ea (patch)
tree9af35ad12f4c07fe0fc98b1e2e15dff4999cec18 /examples
parentc47c0f3216fddedfb8099adbb98eece41f8ec040 (diff)
downloadranger-51d3afc62142d2ead59173200f3d0b03a545a5ea.tar.gz
sxiv-rifle: don't grep if $target is not a file
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/rifle_sxiv.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/rifle_sxiv.sh b/examples/rifle_sxiv.sh
index d0b5058f..5fab6b78 100755
--- a/examples/rifle_sxiv.sh
+++ b/examples/rifle_sxiv.sh
@@ -31,7 +31,7 @@ case "$1" in
     *)  target="$PWD/$1" ;;
 esac
 
-count="$(listfiles | grep -m 1 -ZznF "$target" | cut -d: -f1)"
+[ -f "$target" ] && count="$(listfiles | grep -m 1 -ZznF "$target" | cut -d: -f1)"
 
 if [ -n "$count" ]; then
     listfiles | xargs -0 sxiv -n "$count" --