
* 代表任意, 匹配所有参数, $变量,在shell中取变量的值
“&&” and “||” are AND-OR list operators.
“&&” executes the first command, and then executes the second command iff the exit status of
the first command is zero.
“||” is similar, but executes the second command iff the exit status of the first command is nonzero.
“&&” and “||” both have the same priority.
|| 表示前面插入出错返回非0,则exit 1退出
major=$(awk "\\$2==\"$module\" {print \\$1}" /proc/devices)
\为转义字符 \\就是\,
转义字符的值为后面的值
\"就是"
/表示目录层次
首先脚本需要有执行权限:chmod u x file.sh;方法:
用shell程序执行脚本:根据你的shell脚本的类型,选择shell程序,常用的有sh,bash,tcsh等然后输入命令(其中bash为shell的名称,myshell.sh则为你要执行的代码):bash myshell.sh
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)