Exchange ids vs posts. Support image paste.
This commit is contained in:
24
watch.sh
Executable file
24
watch.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if the correct number of arguments is passed
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 <file_to_watch> <process_name> <command_to_run>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Assign arguments to variables
|
||||
FILE_TO_WATCH=$1
|
||||
PROCESS_NAME=$2
|
||||
COMMAND_TO_RUN=$3
|
||||
|
||||
eval "$COMMAND_TO_RUN" &
|
||||
|
||||
|
||||
# Watch the file for changes
|
||||
while inotifywait -e modify "$FILE_TO_WATCH"; do
|
||||
# Kill the process
|
||||
sudo pkill "$PROCESS_NAME"
|
||||
|
||||
# Run the provided command (like build and run)
|
||||
eval "$COMMAND_TO_RUN" &
|
||||
done
|
||||
Reference in New Issue
Block a user