Shell脚本比较.conf值

时间:2020-06-12 16:24:13

标签: shell comparison

如果有我的.conf文件:

M_DUMP_DB="testing"

现在在我的.sh文件中,我想检查该字段是否等于“正在测试”

#!/bin/bash
source /home/.../conf_name.conf
echo $M_DUMP_DB
# outputs "testing"
if [ "$M_DUMP_DB" = "testing" ]; then
    echo "Condition has met"
fi

比较永远不会得出true,但是如果我在脚本内分配变量,那么比较结果就是true。

0 个答案:

没有答案
相关问题