I need to read some properties from a config file and execute some commands if the properties match certain values. But when I try to compare the value with a string in if condition, it doesn't work.
Below is a small version of what I am trying to do.
#!/bin/bash
source config.file
echo "mode: $mode"
if [ "$mode" = "slow" ];
then
echo "Mode is slow"
fi
The config file looks like this.
###config###
mode=slow
user=admin
password=pwd
###end###
The echo statement prints the values as "slow" but the if condition is never satisfied. What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire