fork download
  1. SOME_COMMAND() { cat; }
  2.  
  3. input_for_SOME_COMMAND() {
  4. local index mainCommand
  5. index=$1; shift || return
  6. for arg; do
  7. printf '%s\n' "$arg" "$((index++)) sub$arg"
  8. done
  9. }
  10.  
  11. SOME_COMMAND <<<"$(input_for_SOME_COMMAND 1 subcommand{1,2,3,4,5})"
  12.  
Success #stdin #stdout 0.01s 5404KB
stdin
Standard input is empty
stdout
subcommand1
1 subsubcommand1
subcommand2
2 subsubcommand2
subcommand3
3 subsubcommand3
subcommand4
4 subsubcommand4
subcommand5
5 subsubcommand5