Linked Questions

Popular Questions

I have a few scripts: - has many functions defined including work() and abort() it looks like this:


echo  Error: $message ..Aborting >log
exit 7

cp ./testfile ./test1           #./testfile doesnt exist so non zero status here

if [ $? -eq 0 ];then
        echo "variable_value"
        abort "Can not copy"
} - parent script is the main script, it looks like this:


. ./

echo "why is this still getting printed"

Basically i have many functions in the file, and i am sourcing that file in to make available all functions. Parent can call any function and any function in can call abort at which point execution of parent should stop, but its not happening, runs to the next step. Is there a way to get around this problem?

I realise that its happening due to assignment step value=$(work). But is there a way to abort execution just at abort function call in this case?

Related Questions