hydrophonitor/scripts/export-config-values.sh
2022-10-23 17:03:54 +03:00

16 lines
322 B
Bash

#!/bin/bash
if [ $# -eq 1 ]; then
CONFIG_FILE=$1
else
CONFIG_FILE=/boot/hydrophonitor/hydrophonitor-config.txt
fi
# Select non-comment lines in CONFIG_FILE, clean horizontal whitespace
args=$(grep -v '^#' $CONFIG_FILE | tr -d '[:blank:]' | tr '\n' ' ')
for arg in $args; do
echo "export $arg"
export "${arg?}"
done