Bash configuration: Difference between revisions
From wikinotes
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Bash is configured in <code>~/.bashrc</code>. Any environment variables or functions you define here will be available in your interactive shell environment. | Bash is configured in <code>~/.bashrc</code>. Any environment variables or functions you define here will be available in your interactive shell environment. | ||
= vi mode = | = Documentation = | ||
< | <blockquote> | ||
{| class="wikitable" | |||
|- | |||
| <code>set</code> docs || https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |||
|- | |||
|} | |||
</blockquote><!-- Documentation --> | |||
= Set Options = | |||
<blockquote> | |||
* <code>-${flag}</code> set option | |||
* <code>+${flag}</code> unset option | |||
<syntaxhighlight lang="bash"> | |||
# examples | |||
set -e `# exit if any pipe/command fails` \ | |||
set -o pipefail `# pipe exitcode is last pipe in pipeline to exit w/ failure` \ | |||
</syntaxhighlight> | |||
== vi mode == | |||
<blockquote> | |||
<syntaxhighlight lang="bash"> | |||
set -o vi | set -o vi | ||
bind -m vi-command 'Control-l: clear-screen' | bind -m vi-command 'Control-l: clear-screen' | ||
bind -m vi-insert 'Control-l: clear-screen' | bind -m vi-insert 'Control-l: clear-screen' | ||
</ | </syntaxhighlight> | ||
</blockquote><!-- vi mode --> | |||
</blockquote><!-- Set Options --> |
Latest revision as of 13:06, 13 August 2021
Bash is configured in ~/.bashrc
. Any environment variables or functions you define here will be available in your interactive shell environment.
Documentation
set
docshttps://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin
Set Options
-${flag}
set option+${flag}
unset option# examples set -e `# exit if any pipe/command fails` \ set -o pipefail `# pipe exitcode is last pipe in pipeline to exit w/ failure` \vi mode
set -o vi bind -m vi-command 'Control-l: clear-screen' bind -m vi-insert 'Control-l: clear-screen'