fork download
  1. #!/bin/bash
  2.  
  3. OUT='PING gw (192.168.1.1) 56(84) bytes of data.
  4. 64 bytes from gw (192.168.1.1): icmp_seq=1 ttl=64 time=0.156 ms
  5. 64 bytes from gw (192.168.1.1): icmp_seq=2 ttl=64 time=0.143 ms'
  6. VAR=`echo $OUT | awk '{print $3}' | tr -d '()'`
  7. echo $VAR
Success #stdin #stdout 0s 23336KB
stdin
Standard input is empty
stdout
192.168.1.1