How to use iterable in Linux Bash shell ?

Today we will check how to use iterable in bash shell linux.

“..” in bash shell linux, is known as iterable which is used to loop from the range mentioned.

Lets see a command to see its illustration.

Iterable Usage

### Iterable use in case of alphabets
[root@nglinux ~]# for i in {A..E}; do echo $i; done
A
B
C
D
E
[root@nglinux ~]# 

### Iterable use in case of numbers
[root@nglinux ~]# for i in {1..5}; do echo $i; done
1
2
3
4
5
[root@nglinux ~]# 

Here {A..E} and {1..5} are known as iterables, provides an easy and convenient way for looping.

Do post your comments/suggestion below.

Leave a Reply

avatar
  Subscribe  
Notify of