![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| i cannot give array declaration in shell script | naree | SUN Solaris | 20 | 02-19-2008 12:27 AM |
| double variable declaration | kotasateesh | Shell Programming and Scripting | 3 | 08-31-2007 02:29 AM |
| Variable assignment in shell scripting | jaiganeshbe | Shell Programming and Scripting | 2 | 02-27-2007 11:48 PM |
| Help with variable declaration | dsravan | Shell Programming and Scripting | 1 | 12-08-2006 12:15 PM |
| Variable declaration | laila63 | High Level Programming | 2 | 07-07-2004 12:37 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Global variable declaration in shell scripting
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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
[/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]$
|
||||
| Google The UNIX and Linux Forums |