-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy path.bash_profile
More file actions
47 lines (44 loc) · 2.75 KB
/
.bash_profile
File metadata and controls
47 lines (44 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# shellcheck shell=bash
# ------------------------------------------------------------------------------
# HOW IT WORKS:
#
# START SHELL
# |
# +-------------------------+-------------------------+
# | | |
# [ LOGIN SHELL ] [ INTERACTIVE SHELL ] [ NON-INTERACTIVE SHELL ]
# (e.g. SSH, Terminal (e.g. Opening a new (e.g. scp, rsync, cron,
# Startup/Login) Terminal tab) automated scripts)
# | | |
# v v v
# Reads: .bash_profile Reads: .bashrc Reads: (Nothing, usually)
# | | |
# +------------+------------+ |
# | |
# v v
# [ EXIT SHELL ] <-----------------------------+
#
#
# WHY WE DO IT LIKE THIS:
#
# .bash_profile .bashrc
# (The Entry Point) (The Engine Room)
# +-----------------------+ +---------------------------------------+
# | | | 1. INTERACTIVE GUARD |
# | 1. Minimal logic | | (Exit early if not interactive) |
# | | | [[ $- != *i* ]] && return |
# | 2. Source .bashrc |-----------> | |
# | if it exists | | 2. SET PATH & ENVIRONMENT |
# | | | |
# +-----------------------+ | 3. SOURCE COMPONENTS |
# | - .aliases, .functions, etc. |
# | |
# | 4. SHELL INTEGRATIONS |
# | - prompt, fzf, etc. |
# +---------------------------------------+
# ------------------------------------------------------------------------------
# .bash_profile is executed for LOGIN shells.
# We keep it minimal and just source .bashrc where all the configuration lives.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi