Hi,

I have observed the following behaviour when a while-read loop is called in a
shell script in sbox2 prompt.

==================================================================
#! /bin/sh
# Sample program
# Requisites
# Compile a sample hello.c in the CWD

logfile=RESULTLOG
rm -rf $logfile

while read one two three; do
        echo "-------------------------------------"  >> $logfile
        if [ $? -eq 0 ]; then
                echo "while read succeded" >> $logfile
                echo "one = $one" >> $logfile
                echo "two = $two" >> $logfile
                echo "three = $three" >> $logfile
        fi

        for i in $one; do
                echo "DEBUG MESSAGE" >> $logfile
                ./hello  >> $logfile
        done
done <<EOF
a for an apple
b for a ball
c for a cat
d for a dog
e for an elephant
f for a fox
g for a goat
h for a horse
i for an ice-cream
EOF

echo "one outside the loop = $one"  >> $logfile
==================================================================

Expected behaviour: Enter the while loop 9 times and read the 9 lines

Problem: The while loop is executed only once
- If a new executable like 'hello' is called inside the while loop, the loop is
executed only once.
- Otherwise, the test runs as expected.

This happens only in the sb2 shell. If the same is run on a Linux bash
shell/Target(ARM) shell the script runs fine.

Please let me know if such a behaviour is already seen in scratchbox and
provide your inputs

Thanks & Regards,
Chandana.
_______________________________________________
Scratchbox-users mailing list
Scratchbox-users@lists.scratchbox.org
http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-users

Reply via email to