neurolabs / henplus

HenPlus is a SQL shell that can handle multiple sessions in parallel. The commandline interface with the usual history functions features TAB-completion for commands, tables and columns. Database connect via JDBC.
GNU General Public License v2.0
97 stars 51 forks source link

Silent feature similar to SQLPlus #11

Open tbk303 opened 13 years ago

tbk303 commented 13 years ago

It would be of great help if there was a -silent or -s option on the comand line like in SQLPlus that would remove all the gratuitous output like the startup output, the prompt and the timing so that it only outputs the result of the query, nothing else.

I mainly need this so I can select a value from a database column directly into a Unix environment variable. This would be an example -

!/bin/sh

VALUE=henplus -silent user/password@instance <<END set-property sql-result-showheader off set-property sql-result-showfooter off set-property column-delimiter "" select max(c1) from t1; exit END if [ -z "$VALUE" ]; then echo "No rows returned from database" exit 0 else echo $VALUE fi