steeldriver is correctsteeldriver is correct. What you should do is either:
Use a command that reads in the standard input:
#!/bin/bash fun=$(cat) echo "$fun"
Or simply:
#!/bin/bash
cat
Or, to convert standard input into positional parameters, use
xargs:$ echo 1 | xargs ./test.shOr, use the script the way it is supposed to be used (as coded):
./test.sh 1