Hi all,
How to print variable value which i have assigned inside for loop
because that variable scope is local, but i want to use that variable outside for loop.
Awaiting your great help
Thanks,
Susil
Hi all,
How to print variable value which i have assigned inside for loop
because that variable scope is local, but i want to use that variable outside for loop.
Awaiting your great help
Thanks,
Susil
[/tmp]$ cat try.sh
#! /bin/sh
for runs in 1 2 3
do
A=$runs
echo "Inside loop : $A"
done
echo "Outside loop : $A"
[/tmp]$ ./try.sh
Inside loop : 1
Inside loop : 2
Inside loop : 3
Outside loop : 3
[/tmp]$