Closed minhtrancccp closed 7 months ago
when i checked whether shuf was installed on my machine with type shuf or which shuf, both of them confirmed that shuf is /usr/bin/shuf.
shuf
type shuf
which shuf
shuf is /usr/bin/shuf
but as this log below showed what i observed as i executed bash -x taoup-fortune 2>&1, the program seemed to assume that shuf was unavailable.
bash -x taoup-fortune 2>&1
++ dirname taoup-fortune + dir=. ++ which md5sum + '[' /usr/bin/md5sum ']' ++ md5sum ./taoup ++ cut -d ' ' -f1 + MD5SUM=260d2085d6fdc421c1faf9505dcf2898 + cachefile=./.taoup-fortune.cache.260d2085d6fdc421c1faf9505dcf2898 + '[' '!' -r ./.taoup-fortune.cache.260d2085d6fdc421c1faf9505dcf2898 ']' ++ which cowsay + '[' /usr/bin/cowsay ']' ++ shuf -e + '[' ']' ++ echo test ++ sort -R + '[' test ']' + cat ./.taoup-fortune.cache.260d2085d6fdc421c1faf9505dcf2898 + grep -v '^---' + sort -R + head -n 1 + cowsay -f eyes -n + head -n 2 + tail -n 1 < [37mBetween Plan 9 and Erlang we missed a bus somewhere.[0m[30m[1m - @jacquesm[0m[0m > + echo '' + cowsay -f eyes + tail -n 10 + sed 's/^/[0;32;40m/' [0;32;40m \ [0;32;40m .::!!!!!!!:. [0;32;40m .!!!!!:. .:!!!!!!!!!!!! [0;32;40m ~~~~!!!!!!. .:!!!!!!!!!UWWW$$$ [0;32;40m :$$NWX!!: .:!!!!!!XUWW$$$$$$$$$P [0;32;40m $$$$$##WX!: .<!!!!UW$$$$" $$$$$$$$# [0;32;40m $$$$$ $$$UX :!!UW$$$$$$$$$ 4$$$$$* [0;32;40m ^$$$B $$$$\ $$$$$$$$$$$$ d$$R" [0;32;40m "*$bd$$$$ '*$$$$$$$$$$$o+#" [0;32;40m """" """"""" + echo '(B[m' (B[m
apparently the test for shuf's functionality in the program is by testing whether shuf -e 2>/dev/null doesn't return a null string, which it would as no strings or files were passed into the command.
shuf -e 2>/dev/null
even if the test was to verify whether -e was a valid option for the machine's shuf, that would be redundant as -e was implemented in the first public version of shuf, per the git history of the program in coreutils.
-e
coreutils
a solution could be to adapt the test for cowsay's existence to shuf, such as which shuf 2>/dev/null.
cowsay
which shuf 2>/dev/null
Aha, nice find! Thanks.
Should be resolved in https://github.com/globalcitizen/taoup/commit/affd9fe6dba62031f964078dff6d9c9e2f8ce079
Released as https://github.com/globalcitizen/taoup/releases/tag/v1.1.23
when i checked whether
shuf
was installed on my machine withtype shuf
orwhich shuf
, both of them confirmed thatshuf is /usr/bin/shuf
.but as this log below showed what i observed as i executed
bash -x taoup-fortune 2>&1
, the program seemed to assume thatshuf
was unavailable.apparently the test for
shuf
's functionality in the program is by testing whethershuf -e 2>/dev/null
doesn't return a null string, which it would as no strings or files were passed into the command.even if the test was to verify whether
-e
was a valid option for the machine'sshuf
, that would be redundant as-e
was implemented in the first public version ofshuf
, per the git history of the program incoreutils
.a solution could be to adapt the test for
cowsay
's existence toshuf
, such aswhich shuf 2>/dev/null
.