1

About reture with string and keep other "echo" info

view story
linux-howto

http://www.unix.com – I use below code to get ip, and I want to echo something in the function, but the $IP will be all the value from "echo" I just want to get the real ip, and keep the echo info, any help Code: #!/bin/bash get_ip() {     ip=$(grep -B2 "00:01:02:03:04:05" ip_tmp.log |head -1 |awk '{print $2}')     echo "............."     echo "Guest OS ip is $ip"     echo "............."     #rm ip_tmp.log     echo $ip } IP=$(get_ip) echo "IP is $IP" (HowTos)