linux sh bash命令,bash命令 – shell脚本解释器

bash 是一个为GNU计划编写的Unix shell。它的名字是一系列缩写:Bourne-Again Shell — 这是关于Bourne shell(sh)的一个双关语(Bourne again / born again)。

bash是大多数Linux系统以及Mac OS X默认的shell,它能运行于大多数类Unix风格的操作系统之上,甚至被移植到了Microsoft Windows上的Cygwin系统中,以实现Windows的POSIX虚拟接口。此外,它也被DJGPP项目移植到了MS-DOS上。

语法格式:bash [参数] [文件]

常用参数:

-n检测脚本是否正确,并不执行脚本

-x执行脚本,输出执行过程

-cbash从字符串中读入命令,如果字符串后还有变量就被设定为从$0开始的位置参数

参考实例

使用-n参数检查脚本语法时候正确:

[root@linuxcool ~]# bash -n linuxcool.sh

使用-x参数执行linuxcool.sh脚本并输出执行过程:

[root@linuxcool ~]# bash -x linuxcool.sh

ifconfig

eth0: flags=4163 mtu 1500

inet 192.168.3.21 netmask 255.255.255.0 broadcast 192.168.3.255

inet6 fe80::20c:29ff:fe73:4b2f prefixlen 64 scopeid 0x20

ether 00:0c:29:73:4b:2f txqueuelen 1000 (Ethernet)

RX packets 1175439 bytes 578279763 (551.4 MiB)

RX errors 0 dropped 1574 overruns 0 frame 0

TX packets 165889 bytes 54096266 (51.5 MiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536

inet 127.0.0.1 netmask 255.0.0.0

inet6 ::1 prefixlen 128 scopeid 0x10

loop txqueuelen 1 (Local Loopback)

RX packets 538814 bytes 310506969 (296.1 MiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 538814 bytes 310506969 (296.1 MiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值