Source operator doesn't work in if construction in bash
- by Igor
Hello,
I'd like to include a config file in my bash script with 2 conditions:
1) the config file name is constructed on-the-fly and stored in variable, and 2) in case if config file doesn't exist, the script should fail:
config.cfg:
CONFIGURED=yes
test.sh:
#!/bin/sh
$CFG=config.cfg
echo Source command doesn't work here:
[ -f $CFG ]…