Afficher un message
Vieux 26/08/2006, 14h25   #1
Doug Ritschel
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Bourne Shell: scope of variables in while loop

For some reason, I am not able to access variables that were changed in a
while loop, after the while loop finishes. For example:

i=0
echo "this is a test" | while read line
do
i = `expr $i + 1`
done
echo $i

-------------------------------
The echo statement prints 0 rather than 1. Does anyone know why?



  Réponse avec citation
 
Page generated in 0,05232 seconds with 9 queries