Time of Update: 2015-05-27
標籤:shell1.3
Time of Update: 2015-05-26
標籤:一、基本操作 1、重要快速鍵Tab 補全命令、目錄、參數、檔案名稱等Ctrl+c強制終止當前的程式Ctrl+d
Time of Update: 2015-05-26
標籤:shell 質數用上 whil for if 列印出 100以內的質數#!/bin/bash#author Alvin#version 1.0.0#test for 1-100 zhishua=2while [ $a -le 100 ];do z=1 for (( j = 2;$j < $a;j++ ));do &
Time of Update: 2015-05-24
標籤:shell 條件測試1關於test測試,查看man文檔知運算式的判斷( EXPRESSION ) #EXPRESSION is true! EXPRESSION #EXPRESSION is
Time of Update: 2015-05-25
標籤:shell監控#!/bin/sh#count memory_used_rate,disk_used_rate #@yuanwb 2015-5 #disk_used_rate#Depend on real storage place the parameter ‘Location‘ need to alter.Location=/dev/sda1Disk
Time of Update: 2015-05-25
標籤:shell監控#!/bin/sh#count memory_used_rate,disk_used_rate #@yuanwb 2015-5 #disk_used_rate#Depend on real storage place the parameter ‘Location‘ need to alter.Location=/dev/sda1Disk
Time of Update: 2015-05-23
標籤:shell中的for流程式控制制for迴圈:在shell中用於迴圈。類似於其他程式設計語言中的for,但又有些不同。for迴圈是Bash中最常用的文法結構。常用格式格式一for 變數do 語句done格式二for 變數 in 列表do 語句done格式三for ((變數=初始值; 條件判斷; 變數變化))do 語句done如果do和for想在同一行,需要這樣
Time of Update: 2015-05-23
標籤:shell中的while與unil流程式控制制while迴圈:格式一while 條件;do 語句done格式二 死迴圈while truedo 語句done格式三 死迴圈while :do 語句done格式四 死迴圈while [ 1 ]do 語句done格式五 死迴圈while [ 0 ]do 語句done**
Time of Update: 2015-05-23
標籤:shell ssh bash 密碼 預設遠程主機上已經存在 ~/.ssh 目錄。在自己PC上執行下面指令碼,輸入伺服器使用者名稱和ip地址,下次登入可實現無密碼登入。#!/bin/bashid_res_pub=~/.ssh/id_rsa.pubif [ ! -f "$id_res_pub" ];then ssh-keygen
Time of Update: 2015-05-18
標籤:expect 跳過密碼驗證 #!/bin/bashLocal_Dir=‘/tmp/test_huadan‘Ip=‘192.168.0.221‘PassWord=‘Lhm0125‘Des_Dir=‘/tmp/test_huadan‘List=$(find $Local_Dir -cmin -60)for i in $List do#echo&n
Time of Update: 2015-05-22
標籤:1, $*與[email protected]區別cat a.sh#!/bin/bashfor i in $* #這裡換成[email protected]也是一樣的結果doecho $idonesh a.sh 1 ‘2 3‘123vi a.shfor i in "$*"...sh a.sh 1 ‘2 3‘1 2 3vi a.shfor i in "[email protected]"...sh a.sh 1 ‘2 3‘12
Time of Update: 2015-05-20
標籤:shell 變數一 變數定義1 顯式定義 variable=XXX 沒有空格2 read variable讀取主要寫了如下兩行代碼,讀取name和namefamilyread -p "please input your name:" nameread -p "please input your&
Time of Update: 2015-05-18
標籤: 在Shell裡面判斷字串是否為空白分類: Linux shell2011-12-28 23:18 15371人閱讀 評論(0) 收藏 舉報shell主要有以下幾種方法:echo “$str”|awk ‘{print length($0)}‘expr length “$str”echo “$str”|wc
Time of Update: 2015-05-18
標籤:一個標準的守護進程的啟動指令碼:#! /bin/shWHOAMI=`whoami`PID=`ps -u $WHOAMI | gerp mydaemond | awk '{print $1}'`if (test "$1" = "") thenecho "mydaemond [start][stop][version]"exit 0fiif ( test "$1" =
Time of Update: 2015-05-17
標籤:shell 條件測試 test 條件判斷 Shell有條件測試語句,一般用test命令或是[]命令來完成,它們是條件判斷語句if~then語句的基礎,特別是[]命令。下面我們講解一些條件測試語句。1. test命令實現條件測試
Time of Update: 2015-05-16
標籤:1、數值格式:test "num1" opr "num2"[ "num1" opr "num2" ]opr 取值:相等:-eq不等:-ne大於:-gt小於:-lt 【l是字母L的小寫】小於等於:-le大於等於:-ge2、字串格式:[ str1 opr str2][ opr str ]opr取值:相等:=不等:!=空串:-z非空串:
Time of Update: 2015-05-10
標籤:shell1.關閉不必要的服務ntsysv chkconfig必須開啟的服務有:crond/messagebus/network/iptables/sshd/syslog/sysstat/snmpd關閉不必要的服務指令碼:for i in `chkconfig --list |awk ‘/3:on/ {print $1}‘|grep -v "crond\|messagebus\|s
Time of Update: 2015-05-11
標籤:shell linux 1. #注釋作用, #! 除外此外, 在參數替換 echo ${PATH#*:} 這裡不表示注釋, 數制轉換, 不表示注釋 echo $((2#101011))2. ;命令列分隔字元, 可以在一行中寫多個命令. echo hello; echo there3. ;;終止 case 選項複製代碼 代碼如下:case “$variable” inabc) echo “\$variable = abc”;
Time of Update: 2015-05-26
標籤:c++ 排序演算法 這一系列部落格的特點就是——給出每趟排序的結果本來想著好好寫一下過程,弄個圖片什麼的,不過覺得網上的解析太多了,都比較好,所以這些部落格就算是對自己的總結吧。#include <stdio.h>void ShellSort(int *m, int n){int i,flag,gap;for(gap=n;gap!=1;){gap/=2;do
Time of Update: 2015-05-20
shell指令碼執行的幾種方式執行shell指令碼有以下幾種方式1、相對路徑方式,需先cd到指令碼路徑下[root@banking tmp]# cd /tmp[root@banking tmp]# ./ceshi.sh 指令碼執行成功2、絕對路徑方式[root@banking tmp]# /tmp/ceshi.sh 指令碼執行成功3、bash命令調用[root@banking /]# bash /tmp/ceshi.sh 指令碼執行成功4、. (空格) 相對或絕對方式[root@banking