linux shell 脚本读取 etcstandard_version 文件的内容如果内容是 all则运行脚本a如果内容是 19056则运行脚本b。
你可以使用以下Shell脚本来读取/etc/standard_version文件的内容并根据内容运行相应的脚本:
#!/bin/bash
file="/etc/standard_version"
content=$(cat "$file")
if [ "$content" = "all" ]; then
# 运行脚本a
/path/to/script_a.sh
elif [ "$content" = "19056" ]; then
# 运行脚本b
/path/to/script_b.sh
else
echo "无法识别的内容"
fi
将/path/to/script_a.sh和/path/to/script_b.sh替换为实际的脚本路径。注意,脚本文件需要有可执行权限。
你可以使用chmod命令为脚本文件添加执行权限:
chmod +x /path/to/your_script.sh
然后,你可以运行该脚本:
./your_script.sh
脚本将根据/etc/standard_version文件的内容执行相应的操作
原文地址: http://www.cveoy.top/t/topic/i0D6 著作权归作者所有。请勿转载和采集!