Hi all,
I am trying to run a sleep command and I am receiving a broken pipe when I execute. any help would be greatly appreciated.
sleep `< /dev/urandom tr -dc 0-6 | head -c2`
Hi all,
I am trying to run a sleep command and I am receiving a broken pipe when I execute. any help would be greatly appreciated.
sleep `< /dev/urandom tr -dc 0-6 | head -c2`
Try: LANG=C tr -dc 0-6
instead of tr -dc 0-6
/dev/urandom produces binary number, not human readable numbers
try:
sleep $( $RANDOM | tr -dc '[0-6]' )
A better approach is to use modulo arithmetic, say you want random values from 1 to 10:
sleep $(( ($RANDOM %10) + 1 ))