chris antaki
January 06, 2026

Combine background jobs with Fish

Lets say you have multiple background jobs watching for changes and compiling files (HTML, CSS, etc). Here's how you can combine those jobs:

# Stop jobs when user interrupts.
function stop_jobs
	kill (jobs -p) 2>/dev/null
end
# Ctrl+C sends interrupt signal.
trap stop_jobs SIGINT

# Start jobs.
compile_html &
compile_css &

# Wait for user to interrupt.
wait