I'm trying to create code to determine the status of my ethernet connection. For that I'm trying to capture the output of the command:
route get cnn.com | grep interface
..in code. The output from the CLI is "interface: en0". (depending on if you're wired or wireless)
My (non working code) segment: if [[ route get cnn.com | grep grep interface | head -2 | tail -1 | awk {'print$2'} | cut -f1 -d: -eq "interface: en0" ]]
Output: grep: interface: No such file or directory
Aucun commentaire:
Enregistrer un commentaire