避免shell腳本SQL語句中 *輸出時轉義

腳本test.sh內容如下,在 /home/myname/下執行該腳本,

家目錄下有文件a.txt,test.log,test.sh

#!/bin/bash

sql="select * from emp;"

echo $sql

echo $sql > test.log

執行後結果:

select test.sh a.txt test.log from emp;

如何能讓sql中的*不轉義?

                                                                                                   

修改爲如下:

#!/bin/bash
sql="select * from emp;"

echo "$sql"

echo "$sql" > test.log

再次執行,結果如下

select * from emp;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章