Shuf
shuf¶
Step-in replacement for 'shuf' on systems that lack it. Uses reservoir sampling for arbitrary-size input. Requires the random_int function and a working $RANDOM. Note: this is a work in progress; -o (output file) is not supported.
Arguments¶
- $1 (string): Optional flags: -e (echo mode), -i LO-HI (range), -n N (count),
- $2 (string): File path or arguments (depending on mode)
Exit codes¶
- 0: Success
- 1: RANDOM not available, conflicting options, or invalid argument
Output on stdout¶
- Shuffled lines or values