bash script use cut command at variable and store result at another variable

后端 未结 2 1464
栀梦
栀梦 2020-12-13 19:36

I have a config.txt file with IP addresses as content like this

10.10.10.1:80
10.10.10.13:8080
10.10.10.11:443
10.10.10.12:80

I wa

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 19:55

    You can avoid the loop and cut etc by using:

    awk -F ':' '{system("ping " $1);}' config.txt
    

    However it would be better if you post a snippet of your config.txt

提交回复
热议问题