3 ms·
Unix shell script kit v12 adds new random character functions, motivated by the recent Hacker News post about shell random generation. The new functions use /d
by jph 4y ago
Unix shell script kit v12 adds new random character functions, motivated by the recent Hacker News post about shell random generation.
The new functions use /dev/urandom, are POSIX compatible, and provide various character class helpers to generate :alpha:, :digit:, :graph:, etc., and with a length parameter.
Example:
random_char 'ABCD' 8 => DACABBCA
Original post: https://news.ycombinator.com/item?id=35326648 https://news.ycombinator.com/item?id=35326648