I have this script:
#!/bin/bash
function_1() {
function_2
printf world
}
function_2() {
printf "hello "
return 1
printf "not printed"
}
function_1
which prints hello world
. I would like to stop the execution of the script in function_2 after the first printf
. So the script should only print hello
. I tried return 1
but this only returns back to function_1. I also tried to send a kill signal as proposed in earlier answer but I got the same result as with return 1
.