IaC Application/SHELL (3) 썸네일형 리스트형 정규표현식 - grep [root@localhost ~]# ifconfig ens160: flags=4163 mtu 1500 inet 172.16.0.120 netmask 255.255.255.0 broadcast 172.16.0.255 inet6 fe80::20c:29ff:fe78:c387 prefixlen 64 scopeid 0x20 ether 00:0c:29:78:c3:87 txqueuelen 1000 (Ethernet) RX packets 98223 bytes 17291818 (16.4 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 175785 bytes 20733836 (19.7 MiB) TX errors 0 dropped 0 overruns 0 carrier 0.. 함수 #!/bin/bash #함수 사용법 function C() { echo "I am C Function" } function B() { echo "I am C Function" return 1 } function A() { echo "I am C Function" return 2 } A;echo $? B;echo $? C;echo $? D function D() { echo "I am C Function" return 2 } --실행 [root@localhost ~]# sh /root/function_01.sh I am C Function 2 I am C Function 1 I am C Function 0--return 값을 따로 부여하지 않았으므로 종료상태인 0으로 출력된다 /root/function_0.. SHELL 제어문 case #!/bin/bash echo "###### httpd service script ######" echo "start : s , stop : t , restart : r , status : u" echo -n "원하는 작업을 선택하시오 : " read sel case "$sel" in s) echo "start service" systemctl start httpd ;; t) echo "stop service" systemctl stop httpd ;; r) echo "restart service" systemctl restart httpd ;; u) echo "status service" systemctl status httpd ;; *) echo "지정된 작업을 선택해주세요" ;; e.. 이전 1 다음