I am connecting to oracle database and firing a query and assigning the output to variable
But when I echo the value of the variable it doesn't get printed correctly.
count=`sqlplus -s $configuser/$configpass@$ORACLE_SID <<END
set pagesize 0 feedback off verify off heading off echo off;
select max(cust_id) from cutomers
exit;
END`
echo $count
The query return correct result when fired on database. But "count" variable has incorrect value.
Best Answer
The terminating here-doc word must be the only characters on the line: no indenting allowed. Also, use
$()
instead of backticks -- they are nestable.http://www.gnu.org/software/bash/manual/bashref.html#Here-Documents