View Catalog
awk ' {if (!system ("test-d")) print $} '
Batch Quick Create user
for in user{0.. Ten Do useradd $i echo123456passwd --stdin $i Done
Use the IF statement to determine
#!/bin/bash# file Judgmentif[-E $1]; Then Echo "File exists"fiif[-R $1]; Then Echo "readable"fiif[ -W$1]; Then Echo "writable"fiif[-X $1]; Then Echo "executeable"fiif[-S $1]; Then Echo "Have contents"fiif[-D $1]; Then Echo "Directory"fiif[-F $1]; Then Echo "file"fiif[-C $1]; Then Echo "charactor Device"fiif[-B $1]; Then Echo "Block Device"fi#字符串判断if[ $1="Admin"]; Then Echo "You are admin"fiif[ $1!="Demon"]; Then Echo "You is not demon"fiif[-Z $1]; Then Echo "Zero String"fiif[-N $1]; Then Echo "Not empty"fi#数字判断ifTest $1-eq4; Then Echo "$1=4"fiifTest $1-ne4; Then Echo "$1!=4"fiifTest $1-gt4; Then Echo "$1>4"fiifTest $1-ge4; Then Echo "$1>=4"fiifTest $1-lt4; Then Echo "$1<4"fiifTest $1-le4; Then Echo "$1<=4"fi#C语言语法if(( $1!='Demon')); Then Echo "[C]not Demon"elif(( $1>5)); Then Echo "[c]$1 > 5"fi
Color
Danger="\033[31m"Success="\033[32m"Primary="\033[34m"Warning="\033[33m]"Violet="\033[35m"Info="\033[36m"default="\033[37m"CLS="\033[0m"
Catalog file Statistics
#!/bin/Bashline= ' Tree-i-f |WC-l ' files= ' Tree-i-f |Head-N $ ($line-1)) ' FileCount=0Dircount=0 for file inch$files; Do if[-D $file]; ThenDircount=`Expr$dirCount +1` ; Echo$file ElseFileCount=`Expr$fileCount +1` fi DoneEcho "Dir:"$dirCountEcho "Files:"$fileCount
Shell Programming Notes