From 51d3afc62142d2ead59173200f3d0b03a545a5ea Mon Sep 17 00:00:00 2001 From: NRK Date: Fri, 27 Aug 2021 15:08:42 +0600 Subject: sxiv-rifle: don't grep if $target is not a file --- examples/rifle_sxiv.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') 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" -- -- cgit 1.4.1-2-gfad0