tag: non-recursive

Narrow your search:

  • non-recursive
Log in Sign up
3 Matching Annotations
  1. Feb 2024
  2. unix.stackexchange.com unix.stackexchange.com
    How to write a script that accepts input from stdin or a file?
    1
    1. TylerRick 28 Feb 2024
      in Public
      if [ "$#" -eq 0 ]; then cat else printf '%s\n' "$@" fi |
      not: command line: cat: useless use of cat shell: pipeline non-recursive
    Visit annotations in context

    Tags

    • non-recursive
    • shell: pipeline
    • not:
    • command line: cat: useless use of cat

    Annotators

    • TylerRick

    URL

    unix.stackexchange.com/questions/580971/how-to-write-a-script-that-accepts-input-from-stdin-or-a-file
  3. unix.stackexchange.com unix.stackexchange.com
    Bash function that accepts input from parameter or pipe
    2
    1. TylerRick 28 Feb 2024
      in Public
      if [ "$#" -ne 0 ] then printf '%s\n' "$1" else cat fi |

      Comparible to this solution for the case of a script file (rather than function): https://hyp.is/6UIWdNaREe6L5DMx96BIOA/unix.stackexchange.com/questions/580971/how-to-write-a-script-that-accepts-input-from-stdin-or-a-file

      non-recursive shell: pipeline
    2. TylerRick 28 Feb 2024
      in Public
      Well, here’s a non-recursive solution in which the main commands appear only once:
      non-recursive avoid duplication
    Visit annotations in context

    Tags

    • non-recursive
    • shell: pipeline
    • avoid duplication

    Annotators

    • TylerRick

    URL

    unix.stackexchange.com/questions/301426/bash-function-that-accepts-input-from-parameter-or-pipe
Share:
Group. Only group members will be able to view this annotation.
Only me. No one else will be able to view this annotation.
Hypothes.is
  • About
  • Blog
  • Bioscience
  • Education
  • Jobs
  • Help
  • Contact
  • Terms of Service
  • Privacy Policy