Для этого можно использовать опцию -s
. Из описание POSIXsh
:
sh -s [-abCefhimnuvx] [-o option]... [+abCefhimnuvx] [+o option]...
[argument...]
-s
Read commands from the standard input.
If there are no operands and the -c option is not specified, the -s option shall be assumed.
Так:
% sh -s foo bar
sh-3.2$ echo "$@"
foo bar