电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

编写shell管理脚本

编写shell管理脚本_第1页
1/152
编写shell管理脚本_第2页
2/152
编写shell管理脚本_第3页
3/152
下载后可任意编辑编写 shell 管理脚本:shell 的作用:Shell 是一个特别的应用程序,它介于操作系统内核与用户之间,负责接收用户输入的操作指令并进行解释,将需要执行的操作传递给内核执行。Shell 程序有很多种,windows 里的 cmd.exe 也是 shell 的一种。在 linux/unix 操作系统中,能够使用的 shell 程序有很多种,常见的 shell 如下:Bsh:早期的 unix shell 程序,实现了最基本的命令解释其功能。Csh:使用 C 语言的语法风格,更加适合为用户提供命令交互操作。Ksh:结合了 bsh 和 csh 两者的功能优势。Bash:是 bsh 的升级替代品,目前大多数 linux 默认的 shell 程序。Zsh:更多的基于交互式操作系统考虑设计。Shell 环境的切换:通过配置文件/etc/shells 可以了解系统所支持的 shell 程序的路径。查看当前 linux 系统中能够使用的 shell 程序的列表:[root@localhost ~]# cat /etc/shells/bin/sh/bin/bash/sbin/nologin/bin/dash/bin/tcsh/bin/csh[root@localhost ~]#有一部分 shell 程序实际上是其他 shell 程序的符号链接文件:[root@test ~]# ls -l /bin/*sh-rwxr-xr-x. 1 root root 938832 Jul 18 2024 /bin/bashlrwxrwxrwx. 1 root root 4 Jun 24 22:11 /bin/csh -> tcsh (tcsh 是 csh 的兼容升级版本)-rwxr-xr-x. 1 root root 109672 Oct 17 2024 /bin/dashlrwxrwxrwx. 1 root root 4 Jun 24 22:05 /bin/sh -> bash -rwxr-xr-x. 1 root root 387328 Feb 22 2024 /bin/tcsh[root@test ~]#1.临时切换到新的 shell 环境:直接输入其他 shell 程序的名称即可切换到新的 shell 环境,返回原来的 shell 可执行 exit命令:[root@test ~]# tcsh[root@test ~]#查看当前用户所用的 shell: [root@en script]# echo $SHELL/bin/bash下载后可任意编辑[root@en script]#[root@test ~]# echo $0 (并不是所有 shell 都支持)tcsh[root@test ~]#[root@test ~]# exitexit[root@test ~]# echo $0-bash[root@test ~]#2.更改用户自己的登陆 shell:用户登录 shell 信息记录在/etc/passwd 文件中。用户可以用 chsh 命令进行修改:[root@localhost ~]# grep "root" /etc/passwdroot:x:0:0:root:/root:/bin/bashoperator:x:11:0:operator:/root:/sbin/nologin[root@localhost ~]#普通用户更改自己的...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

编写shell管理脚本

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部