I am writing shell sripts and i need to connect db via sqlplus. when i execute that code

#!/bin/bash
result=$(sqlplus -s username/password@DB  << EOF
set linesize 32000;
set trimspool on;
SELECT * FROM number.IMEI_BLACK WHERE IMEI_14 = '22222224444444' and rownum < 10;
/
exit;
EOF)
echo $result

the result is this, lines are not proper and cannot be read like this. I set linesize 32000 and trimspool on, but didn't work. What other edit or configuration should i make ?

ID IMEI_14 IMEI_15 REASO TIME_ADDE TIME_TO_B NOTIFIED_TO_NETWORK C_FIRST_DETERMINATION_GROUP ---------- -------------- --------------- ----- --------- --------- ------------------- ------------------------------------ 123456789 222222224444444 2222222244444444 9999 09-DEC-13 14-DEC-13 0 ID IMEI_14 IMEI_15 REASO TIME_ADDE TIME_TO_B NOTIFIED_TO_NETWORK C_FIRST_DETERMINATION_GROUP ---------- -------------- --------------- ----- --------- --------- ------------------- ------------------------------------ 1234567829 2222223344444444 22222233444444442 9999 09-DEC-13 14-DEC-13 0

有帮助吗?

解决方案

You should use echo "$result" that ought to do the trick.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top