#!/bin/bash bash -c 'echo first "$1"; echo second "$2"; echo third "$3"; echo all "$@"; printf ">>%s<<\n" "$@" | nl' one "two three" four "five six seven" eight nine
Standard input is empty
first two three
second four
third five
six
seven
all two three four five
six
seven eight nine
1 >>two three<<
2 >>four<<
3 >>five
4 six
5 seven<<
6 >>eight<<
7 >>nine<<