I have this example shell script:
echo /$1/
So I may call
$ . ./script 5 # output: /5/
I want to pipe the script into sh(ell), but can I pass the arg too ?
cat script | sh # output: //
You can pass arguments to the shell using the -s option:
-s
cat script | bash -s 5
2.1m questions
2.1m answers
60 comments
56.9k users