bug-bash
[Top][All Lists]
Advanced

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

Re: How to use variable in a range like {a..b}?


From: Roman Rakus
Subject: Re: How to use variable in a range like {a..b}?
Date: Wed, 12 May 2010 13:57:35 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4

On 05/12/2010 01:27 PM, Peng Yu wrote:
x=10
for i in {1..$x}; do echo $i; done

The above code give me
{1..10}

, rather than printing numbers from 1 to 10.

I'm wondering how to use variable in a range?

This works for me;
x=10; for i in $(eval echo {1..$x}); do echo $i; done
But is not so cute.
RR



reply via email to

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