配置文件config.properties
#以下是配置文件内容,配置文件文件名为config.properties
username=jack
password=33281
shell脚本(脚本名为 readConfig.sh)
#!/bin/bash
source ./config.properties
echo ${username}
注意:我这里把config.properties和readConfig.sh放置在同一文件夹下。
执行结果贴图
说明:如果转载请注明出处!!