til/Development/Bash
hau 37143c7e76 bash snippets 2020-08-07 14:31:06 +07:00
..
README.md big changes 2020-08-07 13:02:22 +07:00
Snippets.md bash snippets 2020-08-07 14:31:06 +07:00

README.md

Bash

Add to ~/.bashrc:

export HISTSIZE=10000
export HISTFILESIZE=10000
export HISTCONTROL=ignoreboth:erasedups
export HISTIGNORE="cd:ls:la:ll:pwd:exit"

shopt -s histappend

Shebang:

#!/usr/bin/env bash
Shorcut Explain
CTRL-A move to begining of line
CTRL-E move to end of line
CTRL-Right move forward a word
CTRL-Left move backward a word
CTRL-W clear the word behind

macOS

In macOS, Bash read ~/.bash_profile not ~/.bashrc, so edit ~/.bash_profile:

[[ -f ~/.bashrc ]] && \
    source ~/.bashrc

To use latest Bash, install bash with Homebrew. Then append to /etc/shells:

/usr/local/bin/bash

Set default shell

chsh -s /usr/local/bin/bash