Linux基础知识之shell语法(linux的shell命令)

date +%F %T

输出格式:

%Y-%m-%d %H:%M:%S

使用数组可以简化函数的传参,可以通过数组的索引来访问参数。

function fun_name(){

local args=("$@")

echo ${args[*]}

local lable_1=${args[0]}

echo ${lable_1}

}

fun_name "$@"

function main(){

fun_name;

}

main();或者main $@

~~~

$#:所有参数的个数

~~~

case...esca语法:

case Word in

pattern1)

Statement(s) to be executed if pattern1 matches

;;

pattern2)

Statement(s) to be executed if pattern2 matches

;;

pattern3)

Statement(s) to be executed if pattern3 matches

;;

*)

Default condition to be executed

;;

esac

~~~

查看CPU架构:

lscpu | egrep 'x86_64|arrch64'

或者lscpu | grep -i 'Architectures'

x86_64为Intel 64或者amd64的CPU

aarch64为arm架构的CPU

鼓励的话语:锋芒如刀,久露必锈;志气似火,暗燃方旺!所有的隐忍,都是为了未来的腾飞!

原文链接:,转发请注明来源!