STDIN and STDOUT

Hallo,

i have a script like:

if [$1] ;then
echo "OK"

else 
echo "ERROR $2 is missing"

fi;

if [$2];then
touch $2

fi;

if [$2];then
 cat $1  | grep xy > $2

fi;

but i must do that with STDIN and STDOUT, when i want to run the script it must not give parameters. It must run like

cat zz | ./rrr.sh > zz_solution.txt

There's an awful lot of useless use of cat in your scripts. The reason why cat is useless here also explains what you should be doing in your script instead: just use redirection. Or just leave things unchanged so other things can do redirection.

grep xy < zz > zz_solution.txt

If you insisted on putting it in a script, which seems unnecessary when it's only one line, you'd just do:

#!/bin/sh
grep xy

Without parameters, grep will read from stdin and print to stdout, and you can redirect it from the outside.