nello script è possibile impostare un'attesa. wait 10
attendere 10 secondi e per uscire dal programma senza CTRL + C
esaminare il comando exit
. Se usi exit 0
significa ok. Ci sono diverse versioni, ma non so cosa significano esattamente in cima alla mia testa.
exit 1
exit 2..... so on and so forth
Aggiornamento
@ Celada
Non c'è bisogno di colpire. Potresti aver appena detto "forse non hai capito bene la domanda" Stackoverflow è qui per aiutare le persone a imparare, non per abbatterle. Hanno inventato Reddit per questo. Per quanto riguarda i codici di uscita, è possibile forzare l'uscita del programma inviando il comando exit() con un codice. Direttamente dal linux.die.net.
Exit Code Number Meaning Example Comments
1 Catchall for general errors let "var1 = 1/0" Miscellaneous errors, such as "divide by zero"
2 Misuse of shell builtins (according to Bash documentation) Seldom seen, usually defaults to exit code 1
126 Command invoked cannot execute Permission problem or command is not an executable
127 "command not found" Possible problem with $PATH or a typo
128 Invalid argument to exit exit 3.14159 exit takes only integer args in the range 0 - 255 (see footnote)
128+n Fatal error signal "n" kill -9 $PPID of script $? returns 137 (128 + 9)
130 Script terminated by Control-C Control-C is fatal error signal 2, (130 = 128 + 2, see above)
255* Exit status out of range exit -1 exit takes only integer args in the range 0 - 255
Che cosa si intende esattamente inviando un Ctrl + C in forma testuale? – betabandido