BASH - Run command for each line in output of previous command

Posted by user1582375 on Super User See other posts from Super User or by user1582375
Published on 2012-10-24T17:37:20Z Indexed on 2012/10/25 5:07 UTC
Read the original article Hit count: 175

Filed under:
|
|
|
|

All, I am want to request all network services using:

 networksetup -listallnetworkservices

I then want to run the below command for each line in produced from the above command:

networksetup -setautoproxyurl "A LINE FROM ABOVE" http://etc...

Adiitonally, I only want to issue the setautoproxyurl command for service with "Ethernet" or "Wi-Fi" in the name

 networksetup -listallnetworkservices | while read line; do networksetup -setautoproxy $line http://etc...

© Super User or respective owner

Related posts about osx

Related posts about bash