可执行脚本
脚本script 一种解释执行的程序
inux下常见的三种脚本程序
shell脚本 *.sh perl脚本*.pl python脚本 *.py
脚本程序 本质是一个文本文件
1 它是一个文本文件
2它具有可执行权限
脚本程序由解释器执行 对应的解释器
shell /bin/sh
perl /bin/perl
python /bin/python3
执行脚本
1 ./hello.py
2 /bin/python hello.py #把脚本程序当作参数传给解释器
shell脚本
#!/bin/sh
echo "hello,world" #echo 打印
chmod +x hellp.sh #添加可执行权限
./hello.sh
注:
无论什么脚本
1第一行必须声明解释器
#!/bin/sh
2 必须有x权限,才能够执行
3 执行程序时,必须加上路径
绝对路径 或者 相对路进

浙公网安备 33010602011771号