Bash 要在读取find thru shuf util时使用管道吗

Bash 要在读取find thru shuf util时使用管道吗,bash,shuffle,Bash,Shuffle,我目前将其用作随机歌曲选择器的输入: done < <(sort -zuR <(find "$dir" -type f \( -name '*.mp3' -o -name '*.ogg' \) -print0)) 您没有写下您的尝试是如何失败的,但快速查看shuf1手册建议使用-z开关使其适应NUL分隔输入。成功:完成

我目前将其用作随机歌曲选择器的输入:

done < <(sort -zuR <(find "$dir" -type f \( -name '*.mp3' -o -name '*.ogg' \) -print0))

您没有写下您的尝试是如何失败的,但快速查看shuf1手册建议使用-z开关使其适应NUL分隔输入。

成功:完成done < <(shuf <(find "$dir" -type f \( -name '*.mp3' -o -name '*.ogg' \) -print0))
done < <(find "$dir" -type f \( -name '*.mp3' -o -name '*.ogg' \) -print0|shuf)
done < <(find "$dir" -type f \( -name '*.mp3' -o -name '*.ogg' \)|shuf)
trksShuf=($(find "$dir" -type f \( -name '*.mp3' -o -name '*.ogg' \)|shuf)