if condition\r\nthen\r\n command1 \r\n command2\r\n ...\r\n commandN \r\nfi<\/pre>\n\u5199\u6210\u4e00\u884c\uff08\u9002\u7528\u4e8e\u7ec8\u7aef\u547d\u4ee4\u63d0\u793a\u7b26\uff09\uff1a<\/p>\n
if [ $(ps -ef | grep -c \"ssh\") -gt 1 ]; then echo \"true\"; fi<\/pre>\n\u672b\u5c3e\u7684fi\u5c31\u662fif\u5012\u8fc7\u6765\u62fc\u5199\uff0c\u540e\u9762\u8fd8\u4f1a\u9047\u5230\u7c7b\u4f3c\u7684\u3002<\/p>\n
if else<\/strong><\/p>\nif else \u8bed\u6cd5\u683c\u5f0f\uff1a<\/p>\n
if condition\r\nthen\r\n command1 \r\n command2\r\n ...\r\n commandN\r\nelse\r\n command\r\nfi<\/pre>\nif else-if else<\/strong><\/p>\nif else-if else \u8bed\u6cd5\u683c\u5f0f\uff1a<\/p>\n
if condition1\r\nthen\r\n command1\r\nelif condition2 \r\nthen \r\n command2\r\nelse\r\n commandN\r\nfi<\/pre>\n\u4ee5\u4e0b\u5b9e\u4f8b\u5224\u65ad\u4e24\u4e2a\u53d8\u91cf\u662f\u5426\u76f8\u7b49\uff1a<\/p>\n
a=10\r\nb=20\r\nif [ $a == $b ]\r\nthen\r\n echo \"a \u7b49\u4e8e b\"\r\nelif [ $a -gt $b ]\r\nthen\r\n echo \"a \u5927\u4e8e b\"\r\nelif [ $a -lt $b ]\r\nthen\r\n echo \"a \u5c0f\u4e8e b\"\r\nelse\r\n echo \"\u6ca1\u6709\u7b26\u5408\u7684\u6761\u4ef6\"\r\nfi<\/pre>\n\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n
a \u5c0f\u4e8e b<\/pre>\nif else\u8bed\u53e5\u7ecf\u5e38\u4e0etest\u547d\u4ee4\u7ed3\u5408\u4f7f\u7528\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n
num1=$[2*3]\r\nnum2=$[1+5]\r\nif test $[num1] -eq $[num2]\r\nthen\r\n echo '\u4e24\u4e2a\u6570\u5b57\u76f8\u7b49!'\r\nelse\r\n echo '\u4e24\u4e2a\u6570\u5b57\u4e0d\u76f8\u7b49!'\r\nfi<\/pre>\n\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n
\u4e24\u4e2a\u6570\u5b57\u76f8\u7b49!<\/pre>\n","protected":false},"excerpt":{"rendered":"\u5982(\u4ee5\u4e0b\u4e3aPHP\u6d41\u7a0b\u63a7\u5236\u5199\u6cd5)\uff1a < ?php if (isset($_GET[“q”])) { sea […]<\/p>\n","protected":false},"author":1481,"featured_media":162406,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-162202","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/162202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1481"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=162202"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/162202\/revisions"}],"predecessor-version":[{"id":162407,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/162202\/revisions\/162407"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/162406"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=162202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=162202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=162202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}