查看当前shell
echo $SHELL grep root /etc/passwd
开头:
#!/bin/bash #!/bin/sh ls -l /bin/sh
shell种类
cat /etc/shells /etc/init.d/nfs /etc/init.d/crond /etc/init.d/rc.d/rc.sysinit
bash --version
shell执行三种方法:
1,sh t.s 或者 shell t.s 2,/server/scripts/t.sh 或者 ./t.sh #注:要有执行权限 3,source t.sh 或者.t.sh #可以将当前脚本中变量 函数 带到shell中# 注:不需要有执行权限 常用于系统脚本调用 例: [root@moban scripts]# cat who.sh user=`whoami` [root@moban scripts]# source who.sh && echo $user root