test 條件運算式說明檔案符號:[root@LAMP test]# help testtest: test [expr] Evaluate conditional expression. Exits with a status of 0 (true) or 1 (false) depending on the evaluation of EXPR. Expressions
前言今天剛好寫了一個自動化打包指令碼,再次使用到了bash shell,好幸福的感覺。這裡主要是想介紹一下select命令,這個命令可以協助我們完成菜單選擇功能。格式我今天也是第一次使用select流程式控制制,在php、Java、C這些語言中並沒有實現select功能。Bash Shell中,select格式如下: select $var in ${list[@]} do statements that can use $var done
標籤:用shell寫的nginx服務程式 可以先添加到/etc/init.d/目錄下。 chkconfig --add nginxd chkconfig nginxd on service nginxd start service nginxd stop service nginxd " restart | reload | test | status " #!/bin/bash#chkconfig: - 85
標籤:http://c.biancheng.net/cpp/view/6998.html開啟文字編輯器,建立一個檔案,副檔名為sh(sh代表shell),副檔名並不影響指令碼執行,見名知意就好,如果你用php寫shell 指令碼,副檔名就用php好了。輸入一些代碼:#!/bin/bashecho "Hello World !"“#!”
標籤:#!/bin/bash while : do neterror=$(/bin/netstat -a | grep -cw "CLOSE_WAIT") echo "get tcp netstate ‘LISTEN‘ number cuccessful!" echo "neterror"$neterror if [ $neterror -gt "10" ]; then echo "too much net error,system will
shell指令碼刪除N天前的檔案夾-----附linux和mac上date命令的不同背景:每日構建的東西,按日期放到不同的檔案夾裡。如今天的構建放到2015-06-01裡,明天的就放到2015-06-02裡,依次類推。時間久了,需要一個指令碼刪除N天前的檔案夾。(本例中N=7,即刪除一周前的構建)。下面直接上代碼,linux版:#! /bin/bashhistoryDir=~/test/today=$(date +%Y-%m-%d)echo "---------today is