Swap shuf for a more universal alternative

This commit is contained in:
Dylan 2016-03-26 09:10:20 +11:00
parent c69a2397a0
commit b829a1a5e5

View file

@ -1923,7 +1923,8 @@ getimage () {
"ascii") getascii; return ;;
*)
if [ "${image: -1}" == "/" ]; then
img="$(find "$image" -type f \( -name '*.jpg' -o -name '*.png' \) -print0 | shuf -n1 -z)"
files=("$image"*.png "$image"*.jpg)
img="$(printf "%s" "${files[RANDOM % ${#files[@]}]}")"
else
img="$image"
fi