title: bash work with escape space and special characters mac os x
body: <p>I have come across an issue that is usually easily worked around but for some reason I cant get around it here.
  In mac os x, I would like to set the network config with the DNS servers, and set the search domains.
  Using the command networksetup -listallnetworkservices
  shows:
  Display Ethernet
  Thunderbolt Ethernet Slot 1, Port 2
  Thunderbolt Ethernet Slot 1, Port 3
  Display FireWire
  Wi-Fi
  Bluetooth PAN</p>
  
  <p>This works:
  networksetup -getdnsservers "Display Ethernet"
  There aren't any DNS Servers set on Display Ethernet.</p>
  
  <p>But when trying to modify the 'Thunderbolt Ethernet Slot 1, Port 2' port, I cannot for some reason escape the spaces and comma properly.  See these examples:</p>
  
  <p>networksetup -getdnsservers Thunderbolt Ethernet Slot 1, Port2
  Thunderbolt is not a recognized network service.
  ** Error: The parameters were not valid.</p>
  
  <p>networksetup -getdnsservers 'Thunderbolt Ethernet Slot 1, Port2'
  Thunderbolt Ethernet Slot 1, Port2 is not a recognized network service.
  ** Error: The parameters were not valid.</p>
  
  <p>networksetup -getdnsservers "Thunderbolt Ethernet Slot1, Port2"
  Thunderbolt Ethernet Slot1, Port2 is not a recognized network service.
  ** Error: The parameters were not valid.</p>
  
  <p>networksetup -getdnsservers "Thunderbolt\ Ethernet\ Slot\ 1,\ Port2"
  Thunderbolt\ Ethernet\ Slot\ 1,\ Port2 is not a recognized network service.
  ** Error: The parameters were not valid.</p>
  
  <p>Not sure what I am doing wrong, and thought this was the way to escape these characters, but not sure what I am missing.  Any help is appreciated.</p>