help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

break out of nested `if`


From: Peng Yu
Subject: break out of nested `if`
Date: Sun, 24 May 2020 08:27:26 -0500

Hi,

`break n` can break out of nested `for`. But sometimes it would be
convenient to break from nested `if`, which does not seem to be an
available feature in bash.

One walkaround is to put the nested `if` in a function and use return
to break from the nested if. But this is not very convenient, as an
extra function must be defined.

Is there a better walkaround to this problem? Thanks.

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]