linux - How to place the output of an echo statement and an arp statement on one line? -


how can output "echo" , "macaddress" on 1 line? i've got:

iprange="192.168.0." macaddress= arp  | grep -w  "$iprange$1" | awk '{print $3,$1}'   ping -c1 "$iprange$1" > /dev/null          if [ $? -eq 0 ]; echo  "deze host met mac address en ip address $macaddress" else  echo "het down" fi 

this output:

virtualbox ~ $ bash test2.sh 149 e0:b9:a5:f8:24:c3 192.168.0.149 deze host met mac address en ip address  

just replace macaddress= arp | grep -w "$iprange$1" | awk '{print $3,$1}'

with macaddress=$(arp | grep -w "$iprange$1" | awk '{print $3,$1}')


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -