查看当前系统shell运行类型

[vagrant@localhost ssh]$ echo $BASH
/bin/bash

 

第一个shell脚本

[vagrant@localhost ssh]$ vi first_shell.sh

#!/bin/bash
echo 'hello world'

[vagrant@localhost ssh]$ ./first_shell.sh
hello world

[vagrant@localhost ssh]$ /bin/bash first_shell.sh
hello world
脚本编写完毕,如何来执行呢,首先执行 shell 脚本需要执行权限,
赋予执行权限:
chmod o+x first_shell.sh 然后./first_shell.sh 执行即可;也可
以直接使用命令执行: /bin/sh first_shell.sh,显示效果一样。

 

posted on 2020-06-25 11:09  ksy_c  阅读(136)  评论(0编辑  收藏  举报