Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Bash (Unix shell)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Control Structures === <!-- '''+++ <code>if</code>''' '''+++ <code>case</code>''' '''+++ <code>for</code>''' '''+++ <code>for ((</code>''' '''+++ <code>while</code> and <code>until</code>''' '''+++ <code>&&</code> and <code>||</code>''' --> Bash supplies "conditional execution" command separators that make execution of a command contingent on the [[Exit status|exit code]] set by a precedent command. For example: <syntaxhighlight lang="bash"> cd "$SOMEWHERE" && ./do_something || echo "An error occurred" >&2 </syntaxhighlight> Where {{code|./do_something}} is only executed if the {{code|cd}} (change directory) command was "successful" (returned an exit status of zero) and the {{code|echo}} command would only be executed if either the {{code|cd}} or the {{code|./do_something}} command return an "error" (non-zero exit status). For all commands the exit status is stored in the special variable <code>$?</code>. Bash also supports {{code|2=bash|if ...;then ...;else ...;fi}} and {{code|2=bash|case $VARIABLE in $pattern)...;;$other_pattern)...;; esac}} forms of conditional command evaluation. <!-- === Boolean Testing === '''+++ <code>test</code> Built-In and Binary''' '''+++ Single Bracket <code>[</code> Built-In and Binary''' '''+++ Double Bracket <code>[[</code> Built-In (and no Binary)''' --><!-- === Pipelines === --><!-- === Subshells === '''+++ Standard Subshells <code>(...)</code>''' '''+++ Command Substitutions <code>$(...)</code>''' '''+++ Pipelines (again) <code>| ... |</code>''' --><!-- === Signals === -->
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Bash (Unix shell)
(section)
Add topic