Quote:
Still don't understand why it does not work with the pipe
It seems you are conflating pipes and command line options. They are unrelated concepts.
A pipe redirects the standard output of one command into the standard input of another. To read what is being sent in via a pipe, a process has to read from standard input using file i/o.
Command line options are usually made available to a program/script through an array (argv for C executables) or special variables ($*, $@, $1, $2, etc) for shell scripts. getopt (a function in the C library and a command for shell script use) is used to process the command line options.
These are two different mechanisms for passing information. If you want to pass what is in param2 in via a pipe, myscript.sh would have to read it from its stdin. However, it's probably using the variable $2 as it expects it on the command line.
Hopefully that helps clear it up. If not, perhaps it's a start.
Take care,
alister