diff --git a/neofetch b/neofetch index e8cb0cb5..c50d5542 100755 --- a/neofetch +++ b/neofetch @@ -2058,8 +2058,10 @@ get_image_source() { *) if [[ -d "$image_source" ]]; then + shopt -s nullglob files=("${image_source%/}"/*.{png,jpg,jpeg,jpe,gif}) - printf -v image "%s" "${files[RANDOM % (${#files[@]} - 1)]}" + shopt -u nullglob + image="${files[RANDOM % ${#files[@]}]}" else image="$image_source"