docs: update dotfiles/bashrc
This commit is contained in:
parent
632aeedefb
commit
f3397396ce
|
@ -2,7 +2,7 @@
|
||||||
title: Bashrc
|
title: Bashrc
|
||||||
description: Details about how I configure my shell
|
description: Details about how I configure my shell
|
||||||
published: true
|
published: true
|
||||||
date: 2024-03-08T00:01:02.134Z
|
date: 2024-03-09T03:22:52.743Z
|
||||||
tags:
|
tags:
|
||||||
editor: markdown
|
editor: markdown
|
||||||
dateCreated: 2024-03-07T23:21:44.989Z
|
dateCreated: 2024-03-07T23:21:44.989Z
|
||||||
|
@ -16,13 +16,13 @@ https://git.thurstylark.com/dotfiles/bashrc/src/branch/master/.bash_profile
|
||||||
|
|
||||||
Bash chooses which dotfile to source based on how it gets run. If starting from a login shell, `~/.bash_profile` will get sourced, but if there's not a command in there to source your `~/.bashrc`, you may find yourself having to `exec bash` after starting bash. This can be fixed by adding the following line to your `~/.bash_profile`:
|
Bash chooses which dotfile to source based on how it gets run. If starting from a login shell, `~/.bash_profile` will get sourced, but if there's not a command in there to source your `~/.bashrc`, you may find yourself having to `exec bash` after starting bash. This can be fixed by adding the following line to your `~/.bash_profile`:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
[ -f ~/.bashrc ]( -f ~/.bashrc .md) && . ~/.bashrc
|
[ -f ~/.bashrc ]( -f ~/.bashrc .md) && . ~/.bashrc
|
||||||
```
|
```
|
||||||
|
|
||||||
I also use `~/.bash_profile` for setting numlock while in a tty:
|
I also use `~/.bash_profile` for setting numlock while in a tty:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
case $(tty) in /dev/tty[0-9]*)
|
case $(tty) in /dev/tty[0-9]*)
|
||||||
setleds -D +num * (numlock for X is set in ~/.xinitrc)
|
setleds -D +num * (numlock for X is set in ~/.xinitrc)
|
||||||
;;
|
;;
|
||||||
|
@ -43,21 +43,21 @@ I'm not going in to detail about every line, but I'll hilight the important part
|
||||||
|
|
||||||
First off, if we're not running bash interactively, there's no use for any of the rest of this, so just skip it.
|
First off, if we're not running bash interactively, there's no use for any of the rest of this, so just skip it.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
# If not running interactively, don't do anything
|
# If not running interactively, don't do anything
|
||||||
[ $- != *i* ]( $- != *i* .md) && return
|
[ $- != *i* ]( $- != *i* .md) && return
|
||||||
```
|
```
|
||||||
|
|
||||||
Another cool option is actually built in to bash: If you call for a directory without any command before it, just `cd` into that directory.
|
Another cool option is actually built in to bash: If you call for a directory without any command before it, just `cd` into that directory.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
# If a directory is given without any command, CD into it.
|
# If a directory is given without any command, CD into it.
|
||||||
shopt -s autocd
|
shopt -s autocd
|
||||||
```
|
```
|
||||||
|
|
||||||
This is where all the other utilities, aliases, and functions get pulled in. Anything in `~/.bashrc.d/` ending in `.bash` will get pulled in.
|
This is where all the other utilities, aliases, and functions get pulled in. Anything in `~/.bashrc.d/` ending in `.bash` will get pulled in.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
for f in ~/.bashrc.d/*.bash; do source "$f"; done
|
for f in ~/.bashrc.d/*.bash; do source "$f"; done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue