回顯輸出問題。shell腳本中的回顯問題
line=table_name
echo "SELECT CASE WHEN FORMAT_TYPE LIKE '%character%' THEN 'replace(replace(replace('||ATTNAME||',''\'',''\\''),''"'',''\"''),''|'',''\|'') as '||ATTNAME||',' ELSE ATTNAME||',' END FROM _V_RELATION_COLUMN WHERE NAME = '$line' ORDER BY ATTNUM;"
輸出我在尋找類似如下:
SELECT CASE WHEN FORMAT_TYPE LIKE '%character%'
THEN 'REPLACE(REPLACE(REPLACE('||ATTNAME||',''\'',''\\''),''"'',''\"''),''|'',''\|'') AS '||ATTNAME||','
ELSE ATTNAME||','
END
FROM _V_RELATION_COLUMN WHERE NAME IN ('table_name')
ORDER BY ATTNUM;
但要真的誤差
-bash: syntax error near unexpected token `)'
同樣的錯誤:回聲「SELECT CASE WHEN FORMAT_TYPE LIKE '%字符%',然後 '替換(更換(更換(' || ATTNAME ||」, '' \ '', '' \\ ''), '' \ 「 '', '' \\」'), '' | '', '' \ | '') as'|| ATTNAME ||','ELSE ATTNAME ||','END FROM _V_RELATION_COLUMN WHERE NAME ='$ line'ORDER BY ATTNUM;「 –
爲什麼添加更多未轉義的雙引號? – 2015-04-23 11:03:19