Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Regarding the paragraph about ignoring errors: Using exit will be more efficient than true, since exit is builtin to the shell, but true will need to spawn a process. Even quicker would be a simple no-op (:) ! Commented Mar 6, 2018 at 18:08
  • @user1404316, true is a built-in in all modern Bourne-like shells including bash, just like : and exit (well those are special builtins, but that makes no difference in that regard). And true and false are the commands to express boolean values there. Commented Mar 6, 2018 at 19:30
  • @StéphaneChazelas : I just now double-checked and get conflicting indications in bash version 4.4.12. man builtins does not include true in the synopsis at the beginning of the page, or anywhere else. OTOH, type true does indicate that it is a shell builtin. Maybe a documentation bug. man bash also does not document true. Commented Mar 6, 2018 at 19:43
  • @user1404316, true/false builtins were added in bash-2.0 (96) and zsh-2.0 (91). ksh always had them, though initially (including in ksh86) true was defined as a builtin alias for ":" and false for "let 0". ash originally had true but not false (added later in the 90s on the various BSDs). Commented Mar 6, 2018 at 20:44