시스템(리눅스)2014. 8. 8. 15:08

#!/bin/bash


con_ip=`ping -c 1 controller | grep PING | awk ' { print $3 }'`

echo $con_ip


con_ip 라는 변수에 ping -c 1 controller | grep PING | awk ' { print $3 }'의 결과값을 대입한다.


위 예시의 출력 결과는 controller라는 호스트의 IP가 1.2.3.4라고 가정했을 때

(1.2.3.4)

가 출력된다.

'시스템(리눅스)' 카테고리의 다른 글

우분투 가상 NIC 설정  (0) 2015.01.15
우분투 14.04 network restart  (0) 2014.11.27
CentOS virt-manager 설치방법  (0) 2014.08.13
xming  (0) 2014.08.13
CentOS 최소설치된 환경에서 x-window 설치하기  (0) 2014.08.13
Posted by 캡슐리어