shell程序参数传递给sqlplus

#!/bin/bash
#Filename: sh_sql.sh
. /home/oracle/.bash_profile
seq=$1

log_name=`sqlplus -S '/ as sysdba' <
set  pagesize 0 heading off feedback off linesize 200 echo off termout off trimspool on
select name from v\\$archived_log where sequence#=$seq;
exit
EOF`

echo $log_name

-------------------------------------------------------
~
[oracle@shanxi test]$ bash sh_sql.sh   5
/u01/arch/1_5_798157732.arch
[oracle@shanxi test]$ bash sh_sql.sh   6
/u01/arch/1_6_798157732.arch


按照我的理解在sqlplus 执行之前, shell会对 sqlplus里面的shell变量预处理,替换成某个(些)值; 也就是说当轮到 sqlplus执行的时候,sqlplus里shell变量位置都 已经是常量了。