stty:标准输入:设备不适当的ioctl。从Shell脚本运行Perl脚本

时间:2018-07-10 11:39:37

标签: shell perl unix

这是我从中运行Perl脚本的shell脚本。 ade是一个控件版本控制系统,useview提供了与通常的命令行不同的环境。

当我运行脚本时,它会抛出

  

stty:标准输入:设备不适当的ioctl

当我从命令行手动执行操作而不是使用为自动化而构建的脚本时,Perl脚本将运行而没有任何错误。

#!/bin/sh
    host="slc09xhz.us.oracle.com"
    port=1609
    sid=prtr11db   
    fprResult=/home/$USER/Desktop/myscripts/fprResult.txt
    echo "HOST:$host"
    echo "PORT:$port"
    echo "SID:$sid"
    echo "ENV:$env"
    instance="${host}:${port}/${sid}"
    dvn=tv1
    libpath="/ade/${USER}_${dvn}/fainteg/dist/merant/lib:/usr/lib:/ade/${USER}_${dvn}/dmsc/lib:/ade/${USER}_${dvn}/ldap/lib:/ade/${USER}_${dvn}/oracle/lib:/ade/${USER}_${dvn}/fusionapps/lib/linuxx64:/ade/${USER}_${dvn}/fusionapps/hcm/pyt/lib/linuxx64:/ade/${USER}_${dvn}/bishiphome/dist/clients/epm/Essbase/EssbaseRTC/bin:/ade/${USER}_${dvn}/opmn/lib:/net/slcai797.us.oracle.com/scratch/upatch/v2.17.0/lib/import/common:/net/slcai797.us.oracle.com/scratch/upatch/v2.17.0/lib/perl:/usr/local/bin/perl_5.6.1/lib/5.6.1/i686-linux:/usr/local/bin/perl_5.6.1/lib/5.6.1:/usr/local/bin/perl_5.6.1/lib/site_perl/5.6.1/i686-linux:/usr/local/bin/perl_5.6.1/lib/site_perl/5.6.1:/usr/local/bin/perl_5.6.1/lib/site_perl"
    perlp="/net/slcai797.us.oracle.com/scratch/upatch/v2.17.0/lib/import/common:/net/slcai797.us.oracle.com/scratch/upatch/v2.17.0/lib/perl:/usr/local/bin/perl_5.6.1/lib/5.6.1/i686-linux:/usr/local/bin/perl_5.6.1/lib/5.6.1:/usr/local/bin/perl_5.6.1/lib/site_perl/5.6.1/i686-linux:/usr/local/bin/perl_5.6.1/lib/site_perl/5.6.1:/usr/local/bin/perl_5.6.1/lib/site_perl"
    echo "INSTANCE: $instance"
    ade useview $dvn << EOF > "$fprResult"
    cd /net/slcai797/scratch/upatch/LATEST/bin
    setenv LD_LIBRARY_PATH $libpath
    setenv PATH "${PATH}:${perlp}"
    #printenv | grep PATH
    #printenv | grep LIB
    perl -w /net/slcai797/scratch/upatch/LATEST/bin/uPatchSubmit -INSTANCE=slc09xhz.us.oracle.com:1609/prtr11db -ADE_VIEW_ROOT=$AVR -WAIT_FOR_COMPLETE=N | tee $fprResult
    EOF

1 个答案:

答案 0 :(得分:0)

在不知道脚本细节的情况下,我想您需要交换行:

...
ade useview $dvn << EOF > "$fprResult"   #<-- you setup $fprResult by redirecting
...
perl ...
EOF  # <-- up to here goes in that file, that includes the perl call also

我认为您需要:

ade useview $dvn << EOF > "$fprResult"
...
EOF
perl -w /net/slcai797/scratch/upatch/LATEST/bin/uPatchSubmit -INSTANCE=slc09xhz.us.oracle.com:1609/prtr11db -ADE_VIEW_ROOT=$AVR -WAIT_FOR_COMPLETE=N | tee $fprResult