bug-bash
[Top][All Lists]
Advanced

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

Re: variable creation


From: Chet Ramey
Subject: Re: variable creation
Date: Fri, 31 Dec 2004 12:44:58 -0500
User-agent: Mozilla Thunderbird 0.9 (Windows/20041103)

List User wrote:
I've been using bash for years, and along with a coworker, we could not figure out how create and use a variable based on........ err. well here's what i'm trying to do.

something like this...

for each in 81 82 83 84 ; do
  IP_${each}=$(nmap -sV -v -v -O 192.168.2.$each)
done

then somehow I want to be able to use $IP_$each but of course bash doesn't like this.

Can anyone help me out?

Hint:  look at `eval'.  For instance:

        eval IP_${each}=\$(nmap -sV -v -v -O 192.168.2.$each)

Chet




reply via email to

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