Created
January 3, 2025 12:35
-
-
Save donglixp/f90ea8ee53ac4f62d8381d230b04da5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Name of the input file containing commands | |
input_file="cmd_lines.sh" | |
# Read the input file line by line | |
while IFS= read -r line; do | |
# Skip empty lines and comments | |
if [[ -z "$line" ]] || [[ "$line" =~ ^# ]]; then | |
continue | |
fi | |
# Create a new screen session and execute the command | |
screen -dmS "line-$(date +%s%N)" bash -c "$line" | |
done < "$input_file" | |
echo "Commands launched in separate screens." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment