工作雜記
顯示具有
Shell Script
標籤的文章。
顯示所有文章
顯示具有
Shell Script
標籤的文章。
顯示所有文章
2016年6月6日 星期一
Bash - sdiff, compare two file
# sdiff -s file1 file2
< 代表file1有file2沒有
> 代表file1沒有file2有
| 代表file1有file2有,但是不相同
其他參數
-w 30 限定輸出字元30個
-s 只顯示不同的行
Ref. http://note.tc.edu.tw/943.html
Bash - Date format
依測試時間用來建立test log folder...
# date --date="now" +"%Y%m%d-%H-%M-%S"
2014年10月22日 星期三
Windows command line (or .bat) 跳脫字元
在bat中要輸出">"時,要在前面加上"
^
"
echo ping 127.0.0.1 ^> nul > 123.bat
要輸出"%"時,要在前面加上"
%
"
echo %%~dp0 > 123.bat
2014年6月24日 星期二
Find registry address of NIC by command line
Command:
reg query
HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}
/s /f
"Intel(R) 82579LM Gigabit Network Connection"
Filter:
reg query HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} /s /f "Intel(R) 82579LM Gigabit Network Connection" |
find "{4D36E972-E325-11CE-BFC1-08002BE10318}"
> NICaddr.txt
reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} /s /c /e /f "Intel(R) 82579LM Gigabit Network Connection" | find "HKEY_LOCAL_MACHINE" > NICRegAddr.txt
2012年10月31日 星期三
(Shell Script) Example
cat /sys/plx-ll/link_status > link.log
i=0
while [ "$i" -lt "500" ]
do
ifconfig plxnic0 down
sleep 5
ifconfig plxnic0 up
sleep 5
cat /sys/plx-ll/link_status > link_now.log
diff link.log link_now.log > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "Round$i : Files are the same"
else
echo "Round$i : Files are different"
exit
fi
i=$(($i+1))
done
較舊的文章
首頁
訂閱:
文章 (Atom)