bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scripts one after the other


From: John McKown
Subject: Re: scripts one after the other
Date: Sat, 26 Mar 2016 10:11:30 -0500

On Sat, Mar 26, 2016 at 8:26 AM, Val Krem <address@hidden> wrote:

I'm not sure what you want, but you could always pipe one script into
another and evaluate the input from the later. Or just call the second
script from the first in an if.


It is not the question of PIPE one script to the other. I want to pause the script and see the result then decide to continue or not.


​Something like this? The first "echo" stands in for the entire first part of the script. The last "echo" stands in for the entire second, condition, part of the script

#!/bin/bash
echo "I just did the first thing you asked"
#
​ First section done.
#​
# Now ask if we want to go on
declare -l yesno # automatically lower case ${yesno} value
while /bin/true; do # forever!
    echo -n -e "Do you want to continue?\nReply yes or no:"
    read yesno
    test "${yesno}" = "yes" && break # continue if the reply is yes
    test "${yesno}" = "no" && exit # abort if the reply is no
    echo "Invalid response \"${yesno}\", try again"
done
#
​​
# continue on to the second section
echo "Congratulations, you decided to continue on!"
 


--
How many surrealists does it take to screw in a lightbulb? One to hold the giraffe and one to fill the bathtub with brightly colored power tools.

Maranatha! <><
John McKown

reply via email to

[Prev in Thread] Current Thread [Next in Thread]