我需要根據提供電子郵件地址的SQL輸出設置BASH變量。作爲測試我做:根據SQL輸出設置BASH變量
email=$(echo "SELECT email FROM adr" | sqlplus $user/[email protected]$db)
的echo $email
顯示:
SQL*Plus: Release 8.1.7.0.0 - Production on Fri Oct 25 10:45:06 2013 (c) Copyright 2000 Oracle Corporation. All rights reserved. Connected to: Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production JServer Release 8.1.7.4.0 - Production SQL> 2 Disconnected from Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production JServer Release 8.1.7.4.0 - Production
所以我想我需要一些微調,以剛剛獲得電子郵件地址的?
手動SELECT
如下顯示完整的輸出:
SQL> SELECT email FROM adr;
EMAIL
--------------------------------------------------------------------------------
[email protected]
什麼是搶的e-mail地址的最簡單的方法?
http://stackoverflow.com/questions/15663763/getting-sqlresult-into-bash-variable-without-oracle-header-footer?rq= 1 – Mat