在學習Linux shell scripts時,一個最常見的錯誤就是用for(for line in $(cat file.txt) do …)迴圈逐行讀取檔案。下面的例子可以看出這樣做的結果。檔案file.txt內容:cat file.txtThis is the row No 1;This is the row No 2;This is the row No 3. 用for迴圈的例子:for line in $(cat file.txt); do echo $line;
http://itsecuritylab.eu/index.php/2010/07/05/hide-shell-in-a-target-system/ 貌似關於SHELL的東西大家表示很喜歡,很可愛,很快樂,下面小菜再介紹一種隱藏SHELL的方法,.htaccess攻擊這個必須是APACHE的伺服器哦親們,現在來編輯APACHE設定檔,目標系統:centos5.6 apache2[root@localhost ~]# vi
root@bt:~/test# chgrp --helpUsage: chgrp [OPTION]... GROUP FILE... or: chgrp [OPTION]... --reference=RFILE FILE...Change the group of each FILE to GROUP.With --reference, change the group of each FILE to that of RFILE. -c, --changes like
1、echo $?:任何命令進行時都將返回一個退出狀態,輸出上一個命令的退出狀態,0表示退出成功。2、測試檔案狀態:[ -w text ]測試檔案是否可寫,echo $?輸出為0表示可寫,否則不可寫 [ -d text ]檔案是不是目錄,echo $?輸出為1表示不是目錄。0表示符合,1表示不符合。 [ -w text -a -d text ]檔案是不是可寫並且是不是路徑,-a表示同and,-o表示or- d 目錄
#/bin/sh #add by zhoujf.free log file;DIR_LIST="/product1/port/bin/ocs_subscriber_import/back"LOG_LIST="*201*.unl"GZ_DAY=3DEL_DAY=30CORE_DAY=7CUR_TIME=`date +"%Y%m%d %T"`echo "START AT [$CUR_TIME]"for dir in $DIR_LISTdo if [ ! -d $dir ];then
對於長期在linux 下用bash的人來說,這篇文章很棒。for指令功能好強大!轉自,http://hi.bccn.net/space-21499-do-blog-id-13524.htmlfor可以使一些不支援萬用字元的命令對一系列檔案進行操作。在WIN9X中,TYPE命令(顯示檔案內容)是不支援*.txt這種格式的(WIN2K開始TYPE已支援通配)。遇到類似情況就可以用FOR: for %a in (*.txt) do type %a