Shell Script

실행 결과가 여러 줄일때 echo로 출력하면 1줄로 나오는 경우

1. 개요

실행 결과가 여러 줄일때 echo로 출력하면 1줄로 나오는 경우

ex>

echo `명령어` echo “`명령어`”
tuser@ubuntu:~/script/turtle/bin$ echo `ifconfig`
eth0 Link encap:Ethernet HWaddr 00:0c:29:43:8d:c8 inet addr:172.16.60.128 Bcast:172.16.60.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe43:8dc8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:7309 errors:0 dropped:0 overruns:0 frame:0 TX packets:7196 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:903286 (903.2 KB) TX bytes:1643748 (1.6 MB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:16 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1296 (1.2 KB) TX bytes:1296 (1.2 KB)
tuser@ubuntu:~/script/turtle/bin$ echo “`ifconfig`”
eth0      Link encap:Ethernet  HWaddr 00:0c:29:43:8d:c8
inet addr:172.16.60.128  Bcast:172.16.60.255  Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe43:8dc8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:7341 errors:0 dropped:0 overruns:0 frame:0
TX packets:7218 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:907477 (907.4 KB)  TX bytes:1647012 (1.6 MB)lo        Link encap:Local Loopback
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING  MTU:65536  Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1296 (1.2 KB)  TX bytes:1296 (1.2 KB)

 

2. Command

echo “`[명령어]`”   ; 앞 뒤로 “”를 붙여준다.

Back To Top