dev-env/script/foreachSystem/dcom
2024-12-21 14:19:50 +01:00

25 lines
668 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 "[dev-env]: Executing $COMMAND for all systems"
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"