i have a script, blah.sh. within, it calls bleh.sh. bleh.sh has a read <variable> point. blah.sh (also) has a (separate) read <variable> point. what i want to be able to do is send the first read variable and the second read variable to the blah.sh script (for example, y and y)
bleh.sh:
Code:
#!/bin/sh
echo "enter bleh: "
read bleh
if [ $bleh = "y" -o $bleh = "Y" ]
then
echo "GOOD: $bleh"
else
echo "BAD: no."
fi
blah.sh:
Code:
#!/bin/sh
./bleh.sh
echo "enter blah: "
read blah
if [ $blah = "y" -o $blah = "Y" ]
then
echo "GOOD: $blah"
else
echo "BAD: no."
fi
echo "blah blah blah"
when running blah.sh manually, the steps go fine. it calls bleh, you enter y, it echos, it goes on to the rest of blah, you enter y, it goes on....
if you take out bleh.sh and do something like
echo y | ./blah.sh
it's also fine
but if bleh.sh is there (or if there are two read points in the file), then i can't pass two "y"s to the script to have one go to one and the second go to the next
echo y | (echo y | ./blah.sh) or anything like that, doesn't work. in fact, although nothing gets sent to the second read point, the second if -o block returns "blah.sh: line x: [: too many arguments"
i don't know if version matters in this case, but it's rhel 4