"bash catch ctrl-c in a script" Code Answer's

You're definitely familiar with the best coding language BASIC that developers use to develop their projects and they get all their queries like "bash catch ctrl-c in a script" answered properly. Developers are finding an appropriate answer about bash catch ctrl-c in a script related to the BASIC coding language. By visiting this online portal developers get answers concerning BASIC codes question like bash catch ctrl-c in a script. Enter your desired code related query in the search bar and get every piece of information about BASIC code related question on bash catch ctrl-c in a script. 

bash catch ctrl-c in a script

By RF EngineerRF Engineer on May 03, 2021
#!/bin/bash
# type "finish" to exit

stty -echoctl # hide ^C

# function called by trap
other_commands() {
    tput setaf 1
    printf "\rSIGINT caught      "
    tput sgr0
    sleep 1
    printf "\rType a command >>> "
}

trap 'other_commands' SIGINT

input="$@"

while true; do
    printf "\rType a command >>> "
    read input
    [[ $input == finish ]] && break
    bash -c "$input"
done

Source: stackoverflow.com

Add Comment

0

bash catch ctrl-c in a script

By RF EngineerRF Engineer on May 03, 2021
#!/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: askubuntu.com

Add Comment

0

bash catch ctrl-c in a script

By RF EngineerRF Engineer on May 03, 2021
#!/bin/bash

# trap ctrl-c and call ctrl_c()
trap ctrl_c INT

function ctrl_c() {
        echo "** Trapped CTRL-C"
}

for i in `seq 1 5`; do
    sleep 1
    echo -n "."
done

Source: rimuhosting.com

Add Comment

0

All those coders who are working on the BASIC based application and are stuck on bash catch ctrl-c in a script can get a collection of related answers to their query. Programmers need to enter their query on bash catch ctrl-c in a script related to BASIC code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about bash catch ctrl-c in a script for the programmers working on BASIC code while coding their module. Coders are also allowed to rectify already present answers of bash catch ctrl-c in a script while working on the BASIC language code. Developers can add up suggestions if they deem fit any other answer relating to "bash catch ctrl-c in a script". Visit this developer's friendly online web community, CodeProZone, and get your queries like bash catch ctrl-c in a script resolved professionally and stay updated to the latest BASIC updates. 

BASIC answers related to "bash catch ctrl-c in a script"

View All BASIC queries

BASIC queries related to "bash catch ctrl-c in a script"

Browse Other Code Languages

CodeProZone