&& 與 || 配合
eg:cat test.sh #!/bin/bash[ -e /etc/hosts ] && echo "ok" || echo "fail"bash test.sh okeg:cat test.sh #!/bin/bash[ -e /etc/hostssssss ] && echo "ok" || echo "fail"bash test.sh fail注意這里 && 必須在 || 之前
命令合并操作符 {}
[ -f /home/tecmint/Downloads/xyz1.txt ] || {touch /home/tecmint/Downloads/xyz.txt; echo "The file does not exist"}“The file does not exist”
總結
以上所述是小編給大家介紹的Linux 中的命令鏈接操作符,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VEVB武林網網站的支持!
新聞熱點
疑難解答