7.31 学习shell脚本

发布时间 2023-08-01 11:54:18作者: ITJAMESKING

shell 定义:是一个语言解释器,将命令转化为二进制语言(机器语言)

shell 脚本

window 是.bat

linux 是.sh

格式规范

#! /bin/bash 开头文件程序/bin/sh,也就是bash解释器。

#! /usr/bin/python

运行shell脚本的方式

1.

bash script.sh

sh script.sh

适用于文件本身没权限运行

2.

使用相对路径或者绝对路径(需要文件有x权限)

chmod +x 文件路径

3.

source test.h

. test.h

点等于source-

弱语言类型

history 查看命令的历史