{"version":"1.0","type":"rich","title":"earlyexit helper function","description":"This example presents a shell function named `earlyexit` that checks the exit code of the previous command and halts script execution if a failure occurred. The function captures the status via the `$?` variable, compares it against zero, and prints a diagnostic message before exiting with status 1 on error; otherwise, it reports success. It demonstrates a simple control-flow pattern for robust Bash scripting, relying on standard shell built-ins and the `echo` command for output.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-480d46aa9367f4e231ea9aa0fc68e142?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}