bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How use a local variable in for loop?


From: Peng Yu
Subject: How use a local variable in for loop?
Date: Mon, 26 Jul 2010 20:50:10 -0500

Hi,

The variable f keeps the last value when the for loop is finished. Is
there a way to declare it as a local variable, so that it disappears
after for-loop is finished? (I could unset it, but I want to know if
it can be a local variable)

$ for f in a b; do echo $f; done
a
b
$ echo $f
b

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]