KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I know how to check the status of the previously executed command using $?, and we can make that status using exit command. But for the loops in bash are always returning a status 0 and is there any way I can break the loop with some status. #!/bin/bash while true do if [ -f "/test" ] ; then break ### Here I would like to exit with some status fi done echo $? ## Here I want to check the status.
Tags (comma-separated)
Save Edits
Cancel