码迷,mamicode.com
首页 > 系统相关 > 详细

shell执行三种方法

时间:2016-05-24 06:59:26      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:shell 脚本

查看当前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


本文出自 “LannyMa” 博客,请务必保留此出处http://lannyma.blog.51cto.com/4544390/1782340

shell执行三种方法

标签:shell 脚本

原文地址:http://lannyma.blog.51cto.com/4544390/1782340

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!