How to use output of SqlPlus query to prompt user for more input

This question already has an answer here:

  • How do I prompt for Yes/No/Cancel input in a Linux shell script? 25 answers

  • You need to add calls to sqlplus to get the output of the queries you've written. See this SO question for assistance with that.

    Once you have the output, you can use a conditional, as Raman Sailopal suggested. Something like:

    output1="`sqlplus $statement1`"
    
    read -p "User $input appears $output1 times. Create user? [Y/n]" answer
    if [ -z "$answer" -o "$answer" == "y" -o "$answer" == "Y" ]
    then
        sqlplus $statement2
    else
        echo "Not creating user."
    fi
    
    链接地址: http://www.djcxy.com/p/25538.html

    上一篇: 在Bash中,如何将“你确定[Y / n]”添加到任何命令或别名中?

    下一篇: 如何使用SqlPlus查询的输出提示用户输入更多信息