logo

utils-std

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

paste.sh (655B)


  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/paste"
  6. plans=3
  7. . "${WD}/test-cmd/tap.sh"
  8. . "${WD}/test-cmd/init_env.sh"
  9. banzai=$(mktemp)
  10. seq 1 1000 > "$banzai"
  11. cut -b 1-500 -n "$banzai" > "${banzai}.1"
  12. cut -b 501- -n "$banzai" > "${banzai}.2"
  13. t_file concat "$banzai" -d "\0" "${banzai}.1" "${banzai}.2"
  14. rm "$banzai" "${banzai}.1" "${banzai}.2"
  15. t_foobar_z() {
  16. printf '%s\0' foo bar baz | "$target" -z - -
  17. }
  18. t_cmd foobar_z "$(printf 'foo\tbar\0baz\t\0')" t_foobar_z
  19. t --input='foo bar
  20. baz' input_noargs '' 'foo bar
  21. baz
  22. '