shell script , space word 之间的工作方式类似于 enter

shell script , space between word is working like enter

我想要这样的输出

中央邦 |740|开户 但我越来越喜欢 马迪亚 邦|740|帐户 打开

我为此写了脚本

enter code here

 cd /home/XXXXX/
 USER_NAME=1234
 USER_PWD=1234
 DEBUG=0

清除

echo -e "\n Enter The From Date in specified format like DD-MON-YY \n "
read From_Date

echo -e "\n Enter The To Date in specified format like DD-MON-YY \n "
read To_Date


res=`sqlplus -S -L $USER_NAME/$USER_PWD<<EOF | tail -n +2
set pages 0
set linesize 1000
select sm.state_name||'|'||ua.phone||'|'||cm.err_message from tablename sm,tablename ua,tablename           cm where sm.s_id=ua.u_id and cm.c_id=ua.u_id and trunc(cm.date_created)>='$From_Date' and   trunc(cm.date_created)<='$To_Date';

EOF`

for d in $res;
do
echo $d
done

这个的输出是 马迪亚 邦|740|帐户 打开

我想要这样的输出 中央邦|740|开设账户

删除此块:

for d in $res;
do
echo $d
done

只需使用:

echo "$res"

无需使用 for 循环来打印已格式化的字符串。