Closed DininduSenanayake closed 2 months ago
Few ways to tackle this
shopt -s extglob
CONFIG_FILES=($(ls $CONFIG_DIR/!(*ExampleConfig).txt))
echo "${CONFIG_FILES[@]}"
find
and grep
CONFIG_FILES=($(find "$CONFIG_DIR" -name "*.txt" | grep -v "ExampleConfig.txt"))
echo "${CONFIG_FILES[@]}"
CONFIG_FILES=()
for file in "$CONFIG_DIR"/*.txt; do
if [ "$(basename "$file")" != "ExampleConfig.txt" ]; then
CONFIG_FILES+=("$file")
fi
done
echo "${CONFIG_FILES[@]}"
Abandon this approach in favour of moving ExampleConfig to a different dir
This was addressed in https://github.com/DininduSenanayake/APSIM-eri-mahuika/pull/32
Current version of Slurm script ( and the Snake rule) assigns all of the .txt files to
${CONFIG_FILES}
as perCONFIG_FILES=($(ls $CONFIG_DIR/*.txt))
. This is not desirable as ExampleConfig.txt file is on the same working directory which has to be excluded from the variable. Otherwise, it will create a ghost .apsimx file and NULL array task