logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

shuf.sh (532B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. WD="$(dirname "$0")"
  5. target="${WD}/../cmd/shuf"
  6. plans=5
  7. . "$(dirname "$0")/tap.sh"
  8. t --input='' noargs '' ''
  9. t --input='foo' stdin '' 'foo'
  10. t --input='foo' stdin_dash '-' 'foo'
  11. # ioctl fail on BSDs
  12. # t devnull '/dev/null' ''
  13. t_seq_shuf_wc() {
  14. seq $seq | "$target" "$@" | wc -l | tr -d '[:space:]'
  15. }
  16. seq=20
  17. t_cmd seq20_n10 '10' t_seq_shuf_wc -n 10
  18. seq=7
  19. t_cmd seq7_n10 '7' t_seq_shuf_wc -n 10