≡ Menu

For i in For loop from File

The file “test” has the following…

:~$ cat test
1
2
3
4
5
:~$
for i in `cat test`; do host ns$i.he.net; done

Output

:~$ for i in `cat test`; do host ns$i.he.net; done
ns1.he.net has address 216.218.130.2
ns2.he.net has address 216.218.131.2
ns2.he.net has IPv6 address 2001:470:200::2
ns3.he.net has address 216.218.132.2
ns3.he.net has IPv6 address 2001:470:300::2
ns4.he.net has address 216.66.1.2
ns4.he.net has IPv6 address 2001:470:400::2
ns5.he.net has address 216.66.80.18
ns5.he.net has IPv6 address 2001:470:500::2
:~$

Comments on this entry are closed.

Next post:

Previous post:

Copyright © Nish Vamadevan 2002-2017. All Rights Reserved. Terms and Policies.