Bash configuration

From wikinotes
Revision as of 13:05, 13 August 2021 by Will (talk | contribs)

Bash is configured in ~/.bashrc. Any environment variables or functions you define here will be available in your interactive shell environment.

Documentation

set docs https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin

Set Options

You can set bash option

See docs https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin

  • -${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'