shell默認參數腳本


如果不加參數則默認執行restart函數,加stop,則執行stop函數

#!/bin/bash
# version
function stop(){
  # stop  the command
}
function start(){
  # Start  the command
}
function restart(){
    stop
    sleep 5
    start
}
cmd=$1
${cmd:-restart}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM