I'm a web developer who runs two scripts during web development. One watches for CSS changes and one watched for JS changes. When a change is sensed it will merge and concatenate the appropriate files. You can stop "watching" for changed by Ctr-c'ing and stopping each process.
I just used Tmux windows to run these scripts but other devs who don't use screen or tmux ask to combine these "watch" shell scripts into one file. I'm not sure how to do this as when I combined them only one process runs and when I Ctrl-c it, then the other process starts watching. Optimally there would be a way to get them to work with one call, and to stop both process when a stop call is sent.
I'm assuming I need to fork here but am not sure how to do that. The scripts use standard bash and work on all Unix-based systems. Here's the code so far:
#!/bin/sh # Watch for js template changes. ./template-watch.sh # Watch for changes in sass files and render them to CSS files. sass --watch --style=compressed ../src/scss:../assets/css