1.linux 如何挂在 windows 下的共享目录
mount.cifs //192.168.1.3/server /mnt/server -o user=administrator,pass=123456
linux 下的 server 需要自己手动建一个 后面的 user 与 pass 是 windows 主机的账号和密码 注意空格 和逗号
2.查看 http 的并发请求数与其 TCP 连接状态
[root@localhost ~]# netstat -n | awk ‘/^tcp/ {b[NF]++} END{for(a in b)print a,b[a]}'<p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">还有 ulimit -n 查看 linux 系统打开最大的文件描述符,这里默认 1024,不修改这里 web 服务器修改再大也没用。若要用就修改有几个办法,这里说其中一个:</p><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">修改/etc/security/limits.conf</p><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-family:Monaco, MonacoRegular, 'Courier New', monospace;margin:12px 0px;padding:0px;vertical-align:baseline;text-align:left;width:814.062px;color:rgb(68,68,68);height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);font-size:14px;background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">2</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:794px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">*</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">soft </span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">nofile</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">10240</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">*</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">hard </span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">nofile</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">10240</span></div></div></td></tr></tbody></table></div></div><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">重启后生效</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t2"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">3.用 tcpdump 嗅探 80 端口的访问看看谁最高</span></h3><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">tcpdump -i eth0 -tnn dst port 80 -c 1000</p><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -5&nbsp;</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t3"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">4.查看/var/log 目录下文件数</span></h3><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">ls /var/log/ -lR| grep "^-" |wc -l</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t4"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">5.查看当前系统每个 IP 的连接数</span></h3><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">netstat -antup | awk '/^tcp/ {print $5}'| awk -F: '{print $1}' | sort | uniq -c | sort -rn</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t5"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">6.shell 下 32 位随机密码生成</span></h3><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">cat /dev/urandom | head -1 | md5sum | head -c 32 >> /pass<br></p><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">将生成的 32 位随机数 保存到/pass 文件里了</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t6"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">7.统计出 apache 的 access_log 中访问量最多的 5 个 IP</span></h3><p> cat access_log | awk '{print $1}' | sort | uniq -c | sort -n -r | head -5</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t7"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">8.在 1-39 内取随机数</span></h3> echoNF]++} END{for(a in b)print a,b[a]}'<p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">还有 ulimit -n 查看 linux 系统打开最大的文件描述符,这里默认 1024,不修改这里 web 服务器修改再大也没用。若要用就修改有几个办法,这里说其中一个:</p><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">修改/etc/security/limits.conf</p><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-family:Monaco, MonacoRegular, 'Courier New', monospace;margin:12px 0px;padding:0px;vertical-align:baseline;text-align:left;width:814.062px;color:rgb(68,68,68);height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);font-size:14px;background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">2</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:794px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">*</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">soft </span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">nofile</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">10240</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">*</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">hard </span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">nofile</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">10240</span></div></div></td></tr></tbody></table></div></div><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">重启后生效</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t2"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">3.用 tcpdump 嗅探 80 端口的访问看看谁最高</span></h3><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">tcpdump -i eth0 -tnn dst port 80 -c 1000</p><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -5&nbsp;</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t3"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">4.查看/var/log 目录下文件数</span></h3><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">ls /var/log/ -lR| grep "^-" |wc -l</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t4"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">5.查看当前系统每个 IP 的连接数</span></h3><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">netstat -antup | awk '/^tcp/ {print $5}'| awk -F: '{print $1}' | sort | uniq -c | sort -rn</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t5"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">6.shell 下 32 位随机密码生成</span></h3><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">cat /dev/urandom | head -1 | md5sum | head -c 32 >> /pass<br></p><p style="border:0px;font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;font-size:15px;margin-bottom:5px;vertical-align:baseline;text-indent:2em;color:rgb(68,68,68);background-color:rgb(255,255,255);">将生成的 32 位随机数 保存到/pass 文件里了</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t6"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">7.统计出 apache 的 access_log 中访问量最多的 5 个 IP</span></h3><p> cat access_log | awk '{print $1}' | sort | uniq -c | sort -n -r | head -5</p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:'Microsoft YaHei', Helvetica, Arial, 'Lucida Grande', Tahoma, sans-serif;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;color:rgb(68,68,68);background-color:rgb(255,255,255);"><a name="t7"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">8.在 1-39 内取随机数</span></h3> echo[RANDOM%39+1]9.Linux 系统的开机启动顺序
加载 BIOS–>读取 MBR–>Boot Loader–>加载内核–>用户层 init 一句 inittab 文件来设定系统运行的等级(一般 3 或者 5,3 是多用户命令行,5 是界面)–>init 进程执行 rc.syninit–>启动内核模块–>执行不同级别运行的脚本程序–>执行/etc/rc.d/rc.local(本地运行服务)–>执行/bin/login,就可以登录了。
10.符号链接与硬链接的区别
我们可以把符号链接,也就是软连接 当做是 windows 系统里的 快捷方式。
硬链接 就好像是 又复制了一份.
ln 3.txt 4.txt 这是硬链接,相当于复制,不可以跨分区,但修改 3,4 会跟着变,若删除 3,4 不受任何影响。
ln -s 3.txt 4.txt 这是软连接,相当于快捷方式。修改 4,3 也会跟着变,若删除 4,3 就坏掉了。不可以用了。
11.显示/etc/inittab 中以#开头,且后面跟了一个或者多个空白字符,而后又跟了任意非空白字符的行
grep “^# \{1,\}[^ ]” /etc/inittab
12.显示/etc/inittab 中包含了:一个数字:(即两个冒号中间一个数字)的行
grep “\:[0-9]\{1\}\:” /etc/inittab
13.怎么把脚本添加到系统服务里,即用 service 来调用
在脚本里加入
1 2 3 | #!/bin/bash # chkconfig: 345 85 15 # description: httpd |
然后保存
chkconfig httpd –add 创建系统服务
现在就可以使用 service 来 start or restart
14.写一个脚本,实现批量添加 20 个用户,用户名为 user01-20,密码为 user 后面跟 5 个随机字符
1 2 3 4 5 6 | #!/bin/bash #description: useradd for i in `seq -f“%02g” 1 20`;do useradd useri</span></div><divclass="crayon−line"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px5px;vertical−align:baseline;background:0pxcenter;height:inherit;"><spanclass="crayon−r"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><spanclass="crayon−h"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);"></span><spanclass="crayon−s"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(42,161,152);">"useri</span></div><divclass="crayon−line"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px5px;vertical−align:baseline;background:0pxcenter;height:inherit;"><spanclass="crayon−r"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><spanclass="crayon−h"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);"></span><spanclass="crayon−s"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(42,161,152);">"useri:`echo $RANDOM|md5sum|cut -c 1-5`”|passwd –stdinuseri</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">2</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">done</span></div></div></td></tr></tbody></table></div></div><p style="font-size:15px;border:0px;font-family:inherit;font-style:inherit;margin-bottom:5px;vertical-align:baseline;text-indent:2em;"></p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:inherit;font-style:inherit;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;"><a name="t14"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">15.写一个脚本,实现判断 192.168.1.0/24 网络里,当前在线的 IP 有哪些,能 ping 通则认为在线</span></h3><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-size:14px;font-family:Monaco, MonacoRegular, 'Courier New', monospace;font-style:inherit;margin:12px 0px;padding:0px;vertical-align:baseline;width:814.062px;height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">2</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">3</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">4</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">5</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">6</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">7</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">8</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">9</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">10</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">11</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">12</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">13</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:786px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-p" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">#!/bin/bash</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">for</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">ip</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">in</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">seq</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">255</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">do</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">{</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">ping</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">c</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">192.168.1.</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">$ip</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">2</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">if</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">$</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">?</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">eq</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">then</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">192.168.1.</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">$ip</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">UP</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">else</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">192.168.1.</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">$ip</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">DOWN</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">fi</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">}</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">done</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">wait</span></div></div></td></tr></tbody></table></div></div><p style="font-size:15px;border:0px;font-family:inherit;font-style:inherit;margin-bottom:5px;vertical-align:baseline;text-indent:2em;"></p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:inherit;font-style:inherit;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;"><a name="t15"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">16.写一个脚本,判断一个指定的脚本是否是语法错误;如果有错误,则提醒用户键入 Q 或者 q 无视错误并退出其它任何键可以通过 vim 打开这个指定的脚本</span></h3><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-size:14px;font-family:Monaco, MonacoRegular, 'Courier New', monospace;font-style:inherit;margin:12px 0px;padding:0px;vertical-align:baseline;width:814.062px;height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">2</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">3</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">4</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">5</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">6</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">7</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">8</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">9</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">10</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">11</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">12</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">13</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">14</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">15</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">16</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">17</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">18</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">19</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">20</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">21</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">22</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">23</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:786px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">root</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">@</span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">localhost </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">tmp</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-c" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(88,110,117);"># cat checksh.sh</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-c" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(88,110,117);">#!/bin/bash</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">read</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">p</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"please input check script-> "</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">file</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">if</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">f</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">i</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">2</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">done</span></div></div></td></tr></tbody></table></div></div><p style="font-size:15px;border:0px;font-family:inherit;font-style:inherit;margin-bottom:5px;vertical-align:baseline;text-indent:2em;"></p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:inherit;font-style:inherit;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;"><a name="t14"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">15.写一个脚本,实现判断 192.168.1.0/24 网络里,当前在线的 IP 有哪些,能 ping 通则认为在线</span></h3><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-size:14px;font-family:Monaco, MonacoRegular, 'Courier New', monospace;font-style:inherit;margin:12px 0px;padding:0px;vertical-align:baseline;width:814.062px;height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">2</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">3</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">4</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">5</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">6</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">7</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">8</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">9</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">10</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">11</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">12</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">13</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:786px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-p" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">#!/bin/bash</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">for</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">ip</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">in</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">seq</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">255</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">do</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">{</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">ping</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">c</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">192.168.1.</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">$ip</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">2</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">if</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">$</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">?</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">eq</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">then</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">192.168.1.</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">$ip</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">UP</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">else</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">192.168.1.</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">$ip</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">DOWN</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">fi</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">}</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">done</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">wait</span></div></div></td></tr></tbody></table></div></div><p style="font-size:15px;border:0px;font-family:inherit;font-style:inherit;margin-bottom:5px;vertical-align:baseline;text-indent:2em;"></p><h3 style="border-width:0px 0px 0px 5px;border-left-style:solid;border-left-color:rgb(47,136,154);font-family:inherit;font-style:inherit;margin:2px -21px 10px;padding:0px 44px;vertical-align:baseline;line-height:30.4px;"><a name="t15"></a><span style="border:0px;font-family:inherit;font-size:16px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;">16.写一个脚本,判断一个指定的脚本是否是语法错误;如果有错误,则提醒用户键入 Q 或者 q 无视错误并退出其它任何键可以通过 vim 打开这个指定的脚本</span></h3><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-size:14px;font-family:Monaco, MonacoRegular, 'Courier New', monospace;font-style:inherit;margin:12px 0px;padding:0px;vertical-align:baseline;width:814.062px;height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">2</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">3</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">4</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">5</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">6</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">7</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">8</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">9</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">10</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">11</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">12</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">13</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">14</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">15</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">16</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">17</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">18</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">19</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">20</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">21</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">22</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">23</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:786px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">root</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">@</span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">localhost </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">tmp</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-c" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(88,110,117);"># cat checksh.sh</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-c" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(88,110,117);">#!/bin/bash</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">read</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">p</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"please input check script-> "</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">file</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">if</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">f</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">file ]; then sh -n file</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">2</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">if</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">file</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">2</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">if</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">? -ne 0 ]; then read -p “You input file syntax error,[Type q to exit or Type vim to edit]"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">answer</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">case</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">file syntax error,[Type q to exit or Type vim to edit]"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">answer</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">case</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">answer in q | Q) exit 0 ;; vim ) vim file</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">*</span>)</div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">exit</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">esac</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">fi</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">else</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"file</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">*</span>)</div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">exit</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">esac</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">fi</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">else</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"file not exist” exit 1 fi |
17、写一个脚本:(26 包括 3 个小题)
1、创建一个函数,能接受两个参数:
1)第一个参数为 URL,即可下载的文件;第二个参数为目录,即下载后保存的位置;
2)如果用户给的目录不存在,则提示用户是否创建;如果创建就继续执行,否则,函数返回一个 51 的错误值给调用脚本;
3)如果给的目录存在,则下载文件;下载命令执行结束后测试文件下载成功与否;如果成功,则返回 0 给调用脚本,否则,返回 52 给调用脚本;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | [root@localhost tmp]# cat downfile.sh #!/bin/bash url=</span><spanclass="crayon−cn"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><divclass="crayon−linecrayon−striped−line"style="font−family:inherit;font−style:inherit;margin:0px;padding:0px5px;vertical−align:baseline;height:inherit;border−width:1px;border−color:rgb(204,204,204);"><spanclass="crayon−v"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(38,139,210);">dir</span><spanclass="crayon−o"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(133,153,0);">=</span><spanclass="crayon−sy"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);"></span><spanclass="crayon−cn"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><divclass="crayon−linecrayon−striped−line"style="font−family:inherit;font−style:inherit;margin:0px;padding:0px5px;vertical−align:baseline;height:inherit;border−width:1px;border−color:rgb(204,204,204);"><spanclass="crayon−v"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(38,139,210);">dir</span><spanclass="crayon−o"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(133,153,0);">=</span><spanclass="crayon−sy"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);">2 download() { if [[ ! -d dir</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">then</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">read</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">p</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"dir</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">then</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">read</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">p</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"dir No such directory,create?(y/n)” answer if [[ “answer"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">==</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"y"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">then</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">mkdir</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">p</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">answer"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">==</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"y"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">then</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">mkdir</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">p</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dir else return “51” fi fi cd dir</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">wget</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dir</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">wget</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">url >/dev/null 2>&1 if [ </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">?</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">ne</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">then</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">return</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"52"</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">fi</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">return</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">}</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">download</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);"></span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">?</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">ne</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">then</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">return</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"52"</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">fi</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">return</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">}</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">download</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">url dir</span></div><divclass="crayon−linecrayon−striped−line"style="font−family:inherit;font−style:inherit;margin:0px;padding:0px5px;vertical−align:baseline;height:inherit;border−width:1px;border−color:rgb(204,204,204);"><spanclass="crayon−r"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><spanclass="crayon−h"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);"></span><spanclass="crayon−sy"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);">dir</span></div><divclass="crayon−linecrayon−striped−line"style="font−family:inherit;font−style:inherit;margin:0px;padding:0px5px;vertical−align:baseline;height:inherit;border−width:1px;border−color:rgb(204,204,204);"><spanclass="crayon−r"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><spanclass="crayon−h"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);"></span><spanclass="crayon−sy"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);">? |
18、写一个脚本:(27 包括 2 个小题)
1、创建一个函数,可以接受一个磁盘设备路径(如/dev/sdb)作为参数;在真正开始后面步骤之前提醒用户有危险,并让用户选择是否继续;而后将此磁盘设备上的所有分区清空(提示,使用命令 dd if=/dev/zero of=/dev/sdb bs=512 count=1 实现,注意其中的设备路径不要写错了;
如果此步骤失败,返回 67 给主程序;
接着在此磁盘设备上创建两个主分区,一个大小为 100M,一个大小为 1G;如果此步骤失败,返回 68 给主程序;
格式化此两分区,文件系统类型为 ext3;如果此步骤失败,返回 69 给主程序;
如果上述过程都正常,返回 0 给主程序;
2、调用此函数;并通过接收函数执行的返回值来判断其执行情况,并将信息显示出来;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | if [[ -n </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"></span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">1 =~ “/dev/sd[a-z]” ]]; then local Darray=(`ls /dev/sd[a-z]`) for i in </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">{</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Darray</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">}</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">do</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">{</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Darray</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">}</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">do</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"i” == “1"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Sd</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">1"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Sd</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">i && break done else return 66 fi #当匹配成功,进入选择,告诉用户,是否继续,输错的话进入无限循环,当用户选择Y,则清空目标分区,且跳出while循环 while :;do read -p “Warning!!!This operation will clean Sd data.Next=y,Quit=n [y|n]:"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">Choice</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">case</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Sd data.Next=y,Quit=n [y|n]:"</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">Choice</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">case</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Choice in y) dd if=/dev/zero of=Sd</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">bs</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">512</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">count</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">break</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">||</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">return</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">67</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">n</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">)</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">exit</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">88</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">*</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">)</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"Invalid choice,please choice again."</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">esac</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">done</span></div></div></td></tr></tbody></table></div></div><p style="font-size:15px;border:0px;font-family:inherit;font-style:inherit;margin-bottom:5px;vertical-align:baseline;text-indent:2em;">#使用 echo 传递给 fdisk 进行分区,如果此命令失败,则跳转出去,错误值 68,需要注意的是,有时候这个返回值很诡异,笔者之前成功与否都是返回的 1,后来重启之后,就好了,如果慎重的话,可以对创建的分区,进行判断,不过就需要使用其他工具截取相关字段了,虽有些小麻烦,但无大碍</p><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-size:14px;font-family:Monaco, MonacoRegular, 'Courier New', monospace;font-style:inherit;margin:12px 0px;padding:0px;vertical-align:baseline;width:814.062px;height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:794px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">e</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"n\np\n1\n\n+100M\nn\np\n2\n\n+1024M\nw\n"</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">|</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">fdisk</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">sdb</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">||</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">return</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">68</span></div></div></td></tr></tbody></table></div></div><p style="font-size:15px;border:0px;font-family:inherit;font-style:inherit;margin-bottom:5px;vertical-align:baseline;text-indent:2em;">#格式化之前,让内核重新读取磁盘分区表,值得注意的是,有的系统版本,使用 partprobe 无效,譬如笔者的环境是 rhel5.8,而 rhel6.0 以后,这个命令就很危险了,而使用 partx -a /dev/sdb 则效果更好…此项需慎重,如果格式化失败,则告知把失败的分区定义成变量,且跳出函数,并带出错误值 69</p><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-size:14px;font-family:Monaco, MonacoRegular, 'Courier New', monospace;font-style:inherit;margin:12px 0px;padding:0px;vertical-align:baseline;width:814.062px;height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">2</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">3</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">4</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">5</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">6</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">7</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:794px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">partprobe</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Part</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">fdisk</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">l</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Sd</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">bs</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">512</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">count</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">1</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">break</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">||</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">return</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">67</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">n</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">)</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">exit</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">88</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">*</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">)</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"Invalid choice,please choice again."</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">;</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">esac</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">done</span></div></div></td></tr></tbody></table></div></div><p style="font-size:15px;border:0px;font-family:inherit;font-style:inherit;margin-bottom:5px;vertical-align:baseline;text-indent:2em;">#使用 echo 传递给 fdisk 进行分区,如果此命令失败,则跳转出去,错误值 68,需要注意的是,有时候这个返回值很诡异,笔者之前成功与否都是返回的 1,后来重启之后,就好了,如果慎重的话,可以对创建的分区,进行判断,不过就需要使用其他工具截取相关字段了,虽有些小麻烦,但无大碍</p><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-size:14px;font-family:Monaco, MonacoRegular, 'Courier New', monospace;font-style:inherit;margin:12px 0px;padding:0px;vertical-align:baseline;width:814.062px;height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:794px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">e</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"n\np\n1\n\n+100M\nn\np\n2\n\n+1024M\nw\n"</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">|</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">fdisk</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">sdb</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">||</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">return</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">68</span></div></div></td></tr></tbody></table></div></div><p style="font-size:15px;border:0px;font-family:inherit;font-style:inherit;margin-bottom:5px;vertical-align:baseline;text-indent:2em;">#格式化之前,让内核重新读取磁盘分区表,值得注意的是,有的系统版本,使用 partprobe 无效,譬如笔者的环境是 rhel5.8,而 rhel6.0 以后,这个命令就很危险了,而使用 partx -a /dev/sdb 则效果更好…此项需慎重,如果格式化失败,则告知把失败的分区定义成变量,且跳出函数,并带出错误值 69</p><div class="crayon-syntax crayon-theme-solarized-dark crayon-font-consolas crayon-os-pc print-yes notranslate" style="font-size:14px;font-family:Monaco, MonacoRegular, 'Courier New', monospace;font-style:inherit;margin:12px 0px;padding:0px;vertical-align:baseline;width:814.062px;height:auto;border-width:1px;border-style:solid;border-color:rgb(153,153,153);background:rgb(0,43,54);line-height:16px;"><div class="crayon-toolbar" style="border-top:0px;border-right:0px;border-left:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;width:812.062px;border-bottom:1px solid rgb(187,187,187);font-family:Consolas, ConsolasRegular, 'Courier New', monospace;background:rgb(221,221,221);height:21px;line-height:21px;"><span class="crayon-title" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 4px;vertical-align:baseline;color:rgb(51,51,51);float:left;height:inherit;"></span><div class="crayon-tools" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;height:21px;line-height:21px;float:right;"><div class="crayon-button crayon-plain-button" title="Toggle Plain Code" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -48px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -112px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-copy-button" title="Copy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px -16px;width:24px;height:16px;"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background-position:0px center;background-repeat:no-repeat;height:inherit;line-height:15px;width:24px;background-color:transparent;float:left;"><div class="crayon-button-icon" style="border:0px;font-family:inherit;font-style:inherit;margin:-8px 0px 0px;padding:0px;vertical-align:baseline;background:url("./images/toolbar/buttons.png?ver=20170826") 0px 0px;width:24px;height:16px;"></div></div><span class="crayon-language" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 8px 0px 4px;vertical-align:baseline;color:rgb(153,153,153);float:left;height:inherit;">Shell</span></div></div><div class="crayon-plain-wrap" style="border:0px;font-style:inherit;vertical-align:baseline;background:0px center;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;height:auto;"></div><div class="crayon-main" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;width:812.062px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;"><table class="crayon-table" style="font-size:12px;font-style:inherit;margin-left:0px;vertical-align:baseline;border:none;margin-top:0px;margin-right:0px;margin-bottom:0px;padding:0px;border-spacing:0px;background:none;width:auto;table-layout:auto;"><tbody style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;"><tr class="crayon-row" style="font-style:inherit;background:0px center;border-style:none;margin:0px;padding:0px;vertical-align:top;"><td class="crayon-nums" style="border-width:0px;font-size:12px;font-style:inherit;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;background:rgb(7,54,66);color:rgb(88,110,117);"><div class="crayon-nums-content" style="border:0px;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;background:0px center;white-space:nowrap;font-size:14px;line-height:16px;"><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">1</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">2</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">3</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">4</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">5</div><div class="crayon-num crayon-striped-num" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;text-align:center;height:inherit;border-width:1px;border-color:rgb(204,204,204);">6</div><div class="crayon-num" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;text-align:center;height:inherit;">7</div></div></td><td class="crayon-code" style="border-width:0px;font-size:12px;font-style:inherit;background:0px center;width:794px;font-family:Consolas, ConsolasRegular, 'Courier New', monospace;margin:0px;padding:0px;vertical-align:top;"><div class="crayon-pre" style="font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;color:rgb(0,0,0);white-space:pre;border:none;font-size:14px;background:none;line-height:16px;"><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">partprobe</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Part</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">fdisk</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">l</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Sd</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">|</span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">tail</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">2</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">|</span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">cut</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">d</span>”<span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span>”<span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">f1</span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">`</span></div><div class="crayon-line" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;background:0px center;height:inherit;"><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">for</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-e" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">M</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-st" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">in</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">${Part};do mke2fs -j M</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">ErrorPart</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">M</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">></span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">dev</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">/</span><span class="crayon-t" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(181,137,0);">null</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">ErrorPart</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">=</span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">M &&return 69 done return 0 } |
#下面代码,调用函数,接收函数返回值,根据返回值进行判断哪里出错。
1 2 3 4 5 6 7 | Disk_Mod </span><spanclass="crayon−cn"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><divclass="crayon−linecrayon−striped−line"style="font−family:inherit;font−style:inherit;margin:0px;padding:0px5px;vertical−align:baseline;height:inherit;border−width:1px;border−color:rgb(204,204,204);"><spanclass="crayon−v"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(38,139,210);">Res</span><spanclass="crayon−o"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(133,153,0);">=</span><spanclass="crayon−sy"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);"></span><spanclass="crayon−cn"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(42,161,152);">1</span></div><divclass="crayon−linecrayon−striped−line"style="font−family:inherit;font−style:inherit;margin:0px;padding:0px5px;vertical−align:baseline;height:inherit;border−width:1px;border−color:rgb(204,204,204);"><spanclass="crayon−v"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(38,139,210);">Res</span><spanclass="crayon−o"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(133,153,0);">=</span><spanclass="crayon−sy"style="border:0px;font−family:inherit;font−style:inherit;margin:0px;padding:0px;vertical−align:baseline;height:inherit;color:rgb(220,50,47);">? [ Res</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">eq</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">exit</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Res</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">eq</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">exit</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">0</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Res-eq 66 ] && echo “Error! Invalid input.” [ Res</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">eq</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">67</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"Error! Command -> dd <- Faild."</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Res</span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">-</span><span class="crayon-i" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(131,148,150);">eq</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-cn" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">67</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">]</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-o" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(133,153,0);">&&</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-r" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(203,75,22);">echo</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-s" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(42,161,152);">"Error! Command -> dd <- Faild."</span></div><div class="crayon-line crayon-striped-line" style="font-family:inherit;font-style:inherit;margin:0px;padding:0px 5px;vertical-align:baseline;height:inherit;border-width:1px;border-color:rgb(204,204,204);"><span class="crayon-sy" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);">[</span><span class="crayon-h" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(220,50,47);"> </span><span class="crayon-v" style="border:0px;font-family:inherit;font-style:inherit;margin:0px;padding:0px;vertical-align:baseline;height:inherit;color:rgb(38,139,210);">Res-eq 68 ] && echo “Error! Command -> fdisk <- Faild.” [ $Res-eq 69 ] && echo “Error! Command -> mke2fs <- Faild.” |