I'm getting a count of a table of a informix database. I need to store that count value in to a unix variable in side a script. I tried as follows in below two methods .
nwn@nwntt$echo "select count(*) from table1" | dbaccess testdb > $var
-bash: $var: ambiguous redirect
here is my script ,
var1=0
$INFORMIXDIR/bin/dbaccess <<SQLSTMT
database testdb;
select count(*) from table1;
SQLSTMT
echo var1;
I need to store that table1 count in to var1 and echo it.