
답변1
gnome-terminal
스크립트를 통해 이 작업을 수행하도록 선택할 수 있습니다( 및 IPv4 로 작업한다고 가정 ). 아래에서는 ping된 각 IP 주소에 대한 터미널 창을 열고 조정할 수 있는 픽셀 수만큼 해당 창을 엇갈리게 표시합니다. 각 Gnome 터미널 창은 ping된 IP가 포함된 제목으로 식별됩니다.
스크립트(예: )를 생성한 후에는 다음을 my_ping.sh
사용하여 실행 가능하도록 만드십시오.
$ chmod a+x my_ping.sh # see manual page for `chmod' if needed.
버전 A
$ cat my_ping.sh
#!/usr/bin/bash
ip_array=(8.8.8.8
8.8.4.4
192.168.1.1) # define array with as many IPs as needed
x0=50; y0=50 # top left corner pixel coordinates of 1st term-window to open
pix_offset=50 # pixel xy-offset for subsequently staggered PING windows
for ip in "${ip_array[@]}"; do
sizeloc="80X24+$x0+$y0"
gnome-terminal --window \
--geometry="$sizeloc" \
--title "PING $ip" \
-- \ping "$ip"
x0=$((x0+pix_offset));y0=$((y0+pix_offset))
done
용법:$ my_ping.sh
버전 B
스크립트에 인수로 ping할 IP 주소 목록을 제공할 수 있습니다 my_ping.sh
.
$ cat my_ping.sh
#!/usr/bin/bash
x0=50; y0=50
pix_offset=50
# Include IP type-checking here if needed
for ip in "$@"; do
sizeloc="80X24+$x0+$y0"
gnome-terminal --window \
--geometry="$sizeloc" \
--title "PING $ip" \
-- \ping "$ip"
x0=$((x0+pix_offset)); y0=$((y0+pix_offset))
done
용법:$ my_ping.sh 8.8.8.8 8.8.4.4 192.168.1.1 [...]
이상적으로는 적어도 "버전 B"에서는 IP 주소가 스크립트에 의해 유형 검사되는지 확인해야 합니다. 루프 이전의 스크립트에서 이 작업을 수행합니다 for
. HTH.