ntubski, the script ./stage2 looks for a file for information and this file doesn't exist, so I can't use;
Code:
./names < ./answer | ./translation | ./stage2
my (bad) idea was to make that file from the output then feed it into stage2 all in one go, which didn't work, I get file busy. I've abandoned that idea now because it isn't a good one and it's not very secure (I don't wish to pick up bad habits).
Okay, it's pretty much two questions back to back.
The first question is to choose from 1-5 below.
1.red/green/blue/yellow/magenta
2.magenta/red/green/blue/yellow
3.yellow/magenta/red/green/blue
4.blue/yellow/magenta/red/green
5.green/blue/yellow/magenta/red
The answer from this will give you a specific order for the colours, if you pick '1' the answer would be;
red/green/blue/yellow/magenta
Now for the next question, I'd like that selection of colours with the order they're in, to be used as the next question. So stage2 would look like this;
1.red
2.green
3.blue
4.yellow
5.magenta
but if you'd chosen 5 as your first answer, stage2 would look like this to you;
1.green
2.blue
3.yellow
4.magenta
5.red
Here's how I have it setup,
Code:
#!/bin/bash
PS3=
#echo "Choose from the list below."
select name in red/green/blue/yellow/magenta green/red/blue/yellow/magenta blue/red/green/yellow/magenta yellow/red/green/blue/magenta magenta/red/green/blue/yellow
do
break
done
echo "echo $name"
This is the first script, when this is invoked from the command line it'll ask you the first question and list the options available to you. Once you've chosen 1-5, it then prints your anwser on screen. I have the input for this fed to it from a file named answer (which I can change from 1 to 5). So I use the code;
./names < ./answer and it prints the question and the answer (the answer also being the output).
This is the bit that I'm stuck on, how to make this output the next question. Because the output so far is just one line, I've been feeding it to a script named ./transl which can break-up /red/green/blue/yellow/magenta into;
red
green
blue
yellow
magenta
So I now have all the colours separated, but don't know how to use them for the next question. My idea was to make another script to handle this, so that it takes those five colours which ever order they're in and gives you them as the stage2 question. But how I make a script that handles this I'm unsure.
I thought Admiral Beotch was close with this modified script, but it relies on the information coming from another script or a file.
#!/bin/bash
PS3="Choose (1-5):"
echo "Choose from the list below."
select name in $(./color_gen)
do
break
done
echo "You chose $name."
(./color_gen) is the script/file that's looked for, for this information, is there a way of changing it so that instead it looks for the output