標籤:linux grep 尋找特定字串並顏色顯示[[email protected] test]# grep -n ‘the‘ regular_express.txt --color=auto8:I can‘t finish the test.12:the symbol ‘*‘ is represented as start.15:You are the best is mean you are the no. 1.
標籤:for linux bash shell提供了for命令,用於建立通過一系列值重複的迴圈。每次重複使用系列中的一個值執行一個定義的命令集。for命令基本格式為:for var in listdo commandsdone1.讀取列表中的值#!/bin/bash#basic for commandfor test in a b c d e fdo echo The next state
標籤:until linux until命令剛好與while命令相反,until命令需要制定一條測試命令,這條命令通常產生一個非0的退出狀態,只要測試命令的退出狀態非0,bash shell就會執行列在迴圈中的命令,一旦測試條件返回0退出狀態,迴圈停止!until格式命令:until test commandsdo other conmandsdone樣本:#!/bin/bashvar1=10until
標籤:嵌套 linux 迴圈 嵌套迴圈(內迴圈):一條迴圈語句可以在迴圈中使用任何類型的命令,包括其他迴圈命令樣本1:#!/bin/bashfor (( a = 1; a <= 3; a++ ))do echo "Starting loop $a" for (( b = 1; b <= 3; b++ )) do echo "Inside
標籤:param linux 參數計數特殊變數$#可以儲存執行指令碼時包含的命令列參數個數!#!/bin/bashif [ $# -ne 2 ] then echo Usage:input a belse total=$[ $1 + $2 ] echo The total is $totalfi[[email protected] ~]# ./test33.sh 3