Results 1 to 2 of 2
I am pretty new to BASH scripting, I have a script that will build a list of hosts and it works fine
Code:
for ((i=$START; i<=$END; i++)); do echo "$NAME$i"; ...
- 03-24-2011 #1
[SOLVED] BASH Script help
I am pretty new to BASH scripting, I have a script that will build a list of hosts and it works fine
But I need it to build the START and END on different number formats (i.e. 1 -> 10, 01->10, 001 ->010)Code:for ((i=$START; i<=$END; i++)); do echo "$NAME$i"; done
I am trying to use the seq command but can't get it to work quite right with the -w flag in the following
I am fully aware that this syntax is probably wrong, and need to know how to correct it.Code:for ((myseq=$START; myseq<=$END; myseq ++)) do echo "$NAME${myseq}" done
If you need more info I can provide it.
Thanks
- 03-24-2011 #2
Got it
Code:echo What is the host name minus the numbering? read NAME echo What are the starting and ending numbers for the $NAME hosts? read START END echo " " echo $NAME$START echo "Through" echo $NAME$END echo " " for a in `seq -w $START $END` do echo $NAME$a done


