Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR BASIC

bash catch ctrl-c in a script

#!/bin/bash

function finish() {
        echo "bye bye!"
}

trap finish SIGINT

for number in $(seq 10); do
        echo "TODO: Insert work here..."
        # Insert work to do here.
done
Source by askubuntu.com #
 
PREVIOUS NEXT
Tagged: #bash #catch #script
ADD COMMENT
Topic
Name
4+3 =