Time of Update: 2015-05-25
標籤:第一步:ssh免密碼登陸【用公開金鑰,私密金鑰】第二步:#!/bin/bashwhile read server;do ssh -n $server "[email protected]" 2>&1 |sed "s/^/$server: /" &donewait ./bunsan2.sh free < servers.txt注釋:while read server 把輸入的內容當做變數 server-n
Time of Update: 2015-05-27
標籤:mysql ip 執行個體 建庫 建表cat createdbtable.sh#!/bin/bash#-------------------------------------------------- #Created:2015-05-26#Author:jimmygong#Mail:[email protected]#Function:#Version:1.0#------------------------------------------
Time of Update: 2015-05-28
標籤:shell1.4 使用函數添加環境變數1.4.1
Time of Update: 2015-05-26
標籤:1、前言 快半年沒有寫部落格了,荒廢了很久,工作中的雜事太多,自己越來越懶了。為了鞭策自己成長,還是要堅持寫寫部落格,記錄自己的成長。2、shell函數介紹 文法: [ function ] funname [()]{ action; [return int;] }說明:(1)可以帶function fun() 定義,也可以直接fun() 定義,不帶任何參數。(2)參數返回,可以顯示加:return 返回,如果不加,將以最後一條命令運行結果,作為傳回值。
Time of Update: 2015-05-26
標籤:一、基本操作 1、重要快速鍵Tab 補全命令、目錄、參數、檔案名稱等Ctrl+c強制終止當前的程式Ctrl+d
Time of Update: 2015-05-24
標籤:shell 條件測試1關於test測試,查看man文檔知運算式的判斷( EXPRESSION ) #EXPRESSION is true! EXPRESSION #EXPRESSION is
Time of Update: 2015-05-23
標籤:1、注釋 如果使用bash,則在指令檔頭注釋:#/bin/bash2、將指令檔加上可讀與執行許可權,就可以使用./shell.sh來執行,也可以使用sh shell.sh的方式來直接執行,sh是bash的軟串連3、test判斷語句用法 test -d Desktop && echo "is a dir" || echo "is not a dir" 尋找管道檔案:ll /dev | grep ‘^p‘,在dev目錄下,以p開頭的是管道檔案
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中的if流程式控制制if流量控制:Shell中的條件判斷語句,與其他程式設計語言類似。如果需要知道有哪些條件判斷方式,通過man test就可以得到協助常用格式格式一if 條件; then 語句fi格式二if 條件; then 語句else 語句fi格式三if 條件; then 語句elif 條件;
Time of Update: 2015-05-21
標籤:linux 核心 shell kernel bash Linux作業系統可以分為shell和kernel兩個部分,kernel是核心,提供了作業系統的核心功能。shell是外殼,是串連kernel(核心)和使用者的。也就是說使用者通過shell來使用kernel體供地功能。
Time of Update: 2015-05-18
標籤:history export profile 基礎知識 source 1、Shell特性命令曆史 history !! !$ !n !字元Tab鍵可以補全檔案路徑或者命令alias a="b" unalias a 萬用字元 *匹配零個或多個字元
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
標籤:opkg updateopkg install ddns-scripts luci-app-ddns用上面的命令下載ddns指令碼,編輯設定檔vi /etc/config/ddns配置如下config service "myddns" option enabled "1"
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-19
標籤:在我們學習一些架構的時候,在啟動這個架構的時候一般都會調用一個指令碼,並且給這個指令碼傳遞一些參數,指令碼會根據我們傳遞的參數的不同來進行不同的操作,我們傳遞的參數就是位置變數那指令碼是如何識別我們傳遞的參數的呢?通過$0 $1 ....這樣類似的命令來擷取的,例如:./test.sh a b$0:指令碼自身test.sh$1:指令碼的第一個參數a$2:指令碼的第二個參數b寫一個指令碼,test.sh 在裡面寫上 echo $0echo $1echo
Time of Update: 2015-05-22
標籤:shell while 乘法表同其他語言一樣,迴圈同樣是shell中的指令碼句型 一。文法: while [ 運算式 ]
Time of Update: 2015-05-18
標籤:shell 算術運算 expr let Shell中也可以實現基本算術運算,以及位元運算。 我們總結起來有如下幾點: 1)基本的算術運算子:+、-、*、/、**都支援,最後的**是冪運算; 2)算術運算要和一些命令結合才能使用,如expr`..
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中的變數分為環境變數、位置變數、預定義變數和自訂變數四種。 環境變數 Shell環境變數是一類Shell預定義變數,用於設定系統、指令碼運行時環境的變數,由系統統一命名;環境變數的值一部分由系統設定,另一部分可由使用者自己定義。環境變數的名稱由大寫字母組成。常用的環境變數有: