sqlplus在静默模式下不静默

use*_*441 1 oracle shell sqlplus

我在 shell 脚本中使用 sqlplus 并且它可以工作(sqlplus 没有静默模式)但我可以在终端中看到输出。我尝试使用不同的组合在静音模式下运行它,但它没有用 -

sqlplus -s "$DBUSER/$DBPWD@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=$DBHOST)(Port=$DBPORT))(CONNECT_DATA=(SID=$DBSID)))"  @$SCRHOME/getCsv$sqlFile.sql
Run Code Online (Sandbox Code Playgroud)

<顺便说一句 -s 是黄色而不是黑色,就像 shell 脚本中的 echo 命令>

它有效,但我可以在控制台上看到输出。我也试过:

sqlplus \-s "....
sqlplus \-s \ "...
sqplus -S
sqlplus -s \ << EOF "...
Run Code Online (Sandbox Code Playgroud)

我尝试删除双引号,但在这种情况下,即使 sqlplus 命令也不起作用。我在 shell 脚本中使用这个命令。

Mr.*_*ama 6

正确的格式是:

sqlplus -S LOGIN_INFO @SCRIPT_TO_RUN
Run Code Online (Sandbox Code Playgroud)

“静默”模式不会阻止终端输出。它所做的只是:

-S             Sets silent mode which suppresses the display of
               the SQL*Plus banner, prompts, and echoing of
               commands.
Run Code Online (Sandbox Code Playgroud)

如果要抑制所有终端输出,则需要执行以下操作:
sqlplus ... > /dev/null 2>&1