
脚本script,是一种解释执行的程序(建立一个文本文件,程序写入以后就能执行)
c,java语言为编译执行,需要编译成一个程序再执行
Linux下三种常见脚本
Shell *.sh
Perl*.pl
Python *.py
脚本本质为文本文件
创建脚本文件
#!/bin/sh
echo “hello world”
存储好的脚本文件无法执行将对其进行修改权限使其变为可执行文件
chmod +x hello.sh
执行shell脚本方法
python脚本
创建文本文件
#!/bin/python3
print("hello world")
添加可执行权限
chmod +x hello.py
shell 中的变量
shell中定义一个变量
NAME=value
使用一个变量
${NAME}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)