I\'m trying to execute commands inside a script using read, and when the user uses Ctrl+C, I want to stop the execution of the command, but not exit th
You need to run the command in a different process group, and the easiest way of doing that is to use job control:
#!/bin/bash
# Enable job control
set -m
while :
do
read -t 10 -p "input> " input
[[ $input == finish ]] && break
# set SIGINT to default action
trap - SIGINT
# Run the command in background
bash -c "$input" &
# Set our signal mask to ignore SIGINT
trap "" SIGINT
# Move the command back-into foreground
fg %-
done