The topic proposed from the moderator does not answer this question.
The exit
command in the following script is supposed to exit the entire script.
Which normally happens if you put an exit
command into a function.
But not in this case:
#!/usr/bin/env bash
function embedded()
{
exit 1
ls | head -1
}
jo name="$(embedded)" \
age=50
printf "\nThe script is still alive.\n"
Output:
{"name":null,"age":50}
The script is still alive.
It continues to execute the rest of the script.
Does someone know why this happens?
Is there something inside the jo
program that prevents the exit
?