dev-env/script/foreachSystem/dcom
2024-12-21 02:37:03 +01:00

25 lines
681 B
Bash
Executable File

#!/bin/bash
ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/../.." &> /dev/null && pwd )
source $ENV_DIR/bin/denv_msg
source $ENV_DIR/bin/dcom
COMMAND="$@"
CONFIG_FILE="$ENV_DIR/.systems"
# Check if .systems configuration exists
if [ ! -f "$CONFIG_FILE" ]; then
denv_error_msg "$CONFIG_FILE not found."
exit 1
fi
denv_info_msg "Executing $COMMAND for all systems defined in $CONFIG_FILE"
while IFS=' ' read -r IDENTIFIER DIRECTORY GIT; do # Iterate through all lines in .systems configuration
if [[ "$IDENTIFIER" =~ ^#.* ]] || [ -z "$IDENTIFIER" ]; then # Skip comments and emtpy lines
continue
fi
dcom $IDENTIFIER $COMMAND
echo ""
done < "$CONFIG_FILE"