Expressions are only allowed as the first element of a pipeline

by Jul 21, 2015

Can you please help me understand this error message? I don't get the logic of the message / root cause of the problem. And I don't know how to fix the problem. Lots of google shows this happens to many people and piping commands. 

I want to put this to a script.…/15188.aspx

This works great on the ps command line, but not in a script. It has something to do with the way things are piped together. (I think)

My script is: 

$command ="sqlplus -s $dba_name@"+$db+".world/"+$dba_password

$my_sql ="select sysdate from dual;"

$res = ($my_sql | $command)

I don't understand why I am getting this error and I am not sure what it means and how to fix the error.