一、为什么学习和使用shell编程
二、什么是shell
系统当前支持的所有的shell:
三、shell的分类
为nologin,运行进程的,不允许登录系统,考虑系统安全性
用户名:密码的占位符:uid(用户的id):gid(用户所属基本组的id:关于账号的描述信息:用户家目录:当前用户与系统交互用的shell
本来是bash
修改root的shell为sh
环境变量:
当前用户输入的命令会在这些路径去找它的可执行文件
比如输入ls,会在上述路径依次寻找,如果都找不到,会输出command not found…
打印当前用户的家目录:
打印当前用户:
打印当前用户的id:
四、作为程序设计的语言——shell
五、如何学好shell
六、shell脚本的书写规范
七、shell脚本的执行方式
1、交互式执行
2、作为程序文件执行(常用)
八、执行脚本的方法
方法一:
方法二:
方法三:
方法四:
查看打开子进程:
方法一:
进入休眠,在另一端执行pstree:有子进程
结束之后就没有了
方法二:
执行pstree:有子进程
方法三:
执行pstree:没有子进程
方法四:
执行pstree:没有子进程
方法一:
方法二:
方法三:
方法四:
+号表示进去直接跳到行尾,不加+在行首
方法一:
在子进程里面,userdir这个变量有值为pwd指令的输出,在当前进程没有值为空
方法二:
当前进程也没有值
方法三:
方法四:和方法三一样
九、shell脚本的退出状态码
命令执行成功后会有状态码:
shell脚本也有状态码
取决于最后一条指令
文章来源:https://www.toymoban.com/news/detail-664040.html
文章来源地址https://www.toymoban.com/news/detail-664040.html
到了这里,关于shell基本知识的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!