[20180413]bash 位置参数.txt
--//上午在测试hugepage时,链接http://blog.itpub.net/267265/viewspace-2152888/
--//脚本写的太不灵活,不应该每次测试修改脚本,应该采用传位置参数.
--//修改如下:
$ cat b.sh
#!/bin/bash
grep -i page /proc/meminfo
echo
for i in $(seq 100)
do
nohup sqlplus -s scott/book <<EOF > /dev/null 2>&1 &
variable a number;
exec :a := $1;
--//alter session set "_serial_direct_read"=never;
Select count(*) from t where 1=:a;
host sleep 10
commit;
quit;
EOF
done
echo sleep 5s
sleep 5
echo
grep -i page /proc/meminfo
---//写一个例子测试如下:
$ cat b1.sh
#!/bin/bash
sqlplus scott/book <<EOF
variable a number;
exec :a := $1;
Select count(*) from t where 1=:a;
commit;
quit;
EOF
$ . b1.sh 1
PL/SQL procedure successfully completed.
COUNT(*)
----------
64000
Commit complete.
$ . b1.sh 0
PL/SQL procedure successfully completed.
COUNT(*)
----------
0
Commit complete.
--//不知道当时如何想使用sqlplus &1.一下子思维没有转过来.空闲下来想一下,可以这样写,例子:
$ cat b1.sh
#!/bin/bash
sqlplus -s scott/book <<EOF @/dev/null $1
variable a number;
exec :a := &1;
Select count(*) from t where 1=:a;
commit;
quit;
EOF 1
$ . b1.sh 1
PL/SQL procedure successfully completed.
COUNT(*)
---------
64000
Commit complete.
$ . b1.sh 0
PL/SQL procedure successfully completed.
COUNT(*)
----------
0
Commit complete.
--//做一个记录..