Fix the whitespace issue | get rid of ls and sort

This commit is contained in:
Emre AKYÜZ 2023-06-30 11:06:42 +03:00 committed by GitHub
parent 8a3cf1e6e0
commit f2e89ab984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,7 +38,10 @@ cmd open ${{
shopt -s nullglob
dir="$0"
selected_file="$1"
images=($(ls "$dir"/*.{jpg,jpeg,png,webp,bmp,tiff,tif,raw,ico,exif,heic,heif,gif,avif,jxl} | sort -V))
images=()
for file in "$dir"/*.{jpg,jpeg,png,webp,bmp,tiff,tif,raw,ico,exif,heic,heif,gif,avif,jxl,JPG,PNG}; do
[[ -f "$file" ]] && images+=("$file")
done
for ((i=0; i<${#images[@]}; i++)); do
[[ "${images[i]}" = "$selected_file" ]] && {
sxiv -abiof "${images[@]:i}" "${images[@]:0:i}"