cli connection to oracle on linux I am trying to connect to a local oracle on both windows and linux machines.
I am running the following command 

echo Select count(*) FROM all_tables where owner='schema_name'; | sqlplus USER/PASS@localhost:1521


It works on windows but I get a syntax error on Linux. Can someone please fine tune my command to run on Linux?

This is the error I get:


  -bash: syntax error near unexpected token
You just need to wrap the query in quotes:

echo "Select count(*) FROM all_tables where owner='schema_name';" | sqlplus USER/PASS@localhost:1521