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: Val Krem
Subject: Re: scripts one after the other
Date: Fri, 1 Apr 2016 22:22:36 +0000 (UTC)

Hi  John and all,
Thank you very much for your help. my script is now working as I wanted.
Val






On Saturday, March 26, 2016 10:11 AM, John McKown <address@hidden> wrote:



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]