til/Development/Bash/README.md

49 lines
861 B
Markdown
Raw Normal View History

2020-05-08 18:38:55 +00:00
# Bash
2020-05-22 06:33:45 +00:00
Add to `~/.bashrc`:
```bash
2020-07-08 10:59:30 +00:00
export HISTSIZE=10000
export HISTFILESIZE=10000
2020-05-22 06:33:45 +00:00
export HISTCONTROL=ignoreboth:erasedups
2020-07-07 19:09:18 +00:00
export HISTIGNORE="cd:ls:la:ll:pwd:exit"
2020-07-08 10:59:30 +00:00
shopt -s histappend
2020-05-22 06:33:45 +00:00
```
2020-06-08 17:41:48 +00:00
Shebang:
```sh
#!/usr/bin/env bash
```
2020-07-23 05:39:33 +00:00
| 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`:
```bash
[[ -f ~/.bashrc ]] && \
source ~/.bashrc
```
2020-07-23 08:14:13 +00:00
To use latest Bash, install `bash` with Homebrew.
2020-07-23 05:39:33 +00:00
Then append to `/etc/shells`:
```txt
/usr/local/bin/bash
```
Set default shell
```
chsh -s /usr/local/bin/bash
```