[20231123]函数与bash shell调用.txt
--//前一阵子调式bash shell时遇到的问题:
$ ./kd_off.sh 4,155 n
./kd_off.sh: line 9: rlbbed: command not found
./kd_off.sh: line 10: rlbbed: command not found
./kd_off.sh: line 11: rlbbed: command not found
./kd_off.sh: line 15: rlbbed: command not found
x /rn dba 4,155 offset 0
x /rn dba 4,155 offset 0
./kd_off.sh: line 30: rlbbed: command not found
sb2 kd_off[-2] @2 0
sb2 kd_off[-1] @4 0
--//原来我机器上的rlbbed是定义为函数,这样调用无法访问,如果使用alias就没有问题。
$ export RLWRAP=$(which rlwrap)
$ type rlbbed
rlbbed is a function
rlbbed ()
{
cd /home/oracle/bbed;
$RLWRAP -s 9999 -c -r -i -f /usr/local/share/rlwrap/bbed $ORACLE_HOME/bin/bbed parfile=bbed.par cmdfile=cmd.par
}
--//得到别人的提醒,可以使用export -f rlbbed.测试看看.
--//执行如下类似
--// declare -x -f NAME
$ export -f rlbbed
$ ./kd_off.sh 4,155 n
x /rn dba 4,155 *kd_off[2]
x /rn dba 4,155 *kd_off[3]
x /rn dba 4,155 *kd_off[4]
x /rn dba 4,155 *kd_off[5]
x /rn dba 4,155 *kd_off[6]
x /rn dba 4,155 *kd_off[7]
x /rn dba 4,155 *kd_off[8]
x /rn dba 4,155 *kd_off[9]
x /rn dba 4,155 *kd_off[10]
x /rn dba 4,155 *kd_off[11]
x /rn dba 4,155 *kd_off[12]
x /rn dba 4,155 *kd_off[13]
x /rn dba 4,155 offset 7977
x /rn dba 4,155 offset 7965
sb2 kd_off[0] @136 8020
sb2 kd_off[1] @138 8008
sb2 kd_off[2] @140 7996
sb2 kd_off[3] @142 7984
sb2 kd_off[4] @144 7972
sb2 kd_off[5] @146 7960
sb2 kd_off[6] @148 7948
sb2 kd_off[7] @150 7936
sb2 kd_off[8] @152 7924
sb2 kd_off[9] @154 7912
sb2 kd_off[10] @156 7900
sb2 kd_off[11] @158 7889
sb2 kd_off[12] @160 7877
sb2 kd_off[13] @162 7865
--//如何取消呢?我不知道.