Skip to content

Commit 27e494a

Browse files
committed
improve bash settings
1 parent 1ac50ab commit 27e494a

2 files changed

Lines changed: 24 additions & 28 deletions

File tree

bash/.bashrc.d/interactive

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
11
#!/bin/bash
22
# NOTE: shebang for shellcheck
33

4-
# shellcheck disable=SC1091
5-
[ -r "$HOME/.cache/sh_user_path" ] && source "$HOME/.cache/sh_user_path"
4+
__main() {
5+
unset -f __main
66

7-
# shellcheck disable=SC1091
8-
source "$HOME/.bashrc.d/profile"
7+
#-----------------------------------------------------------------------------
98

10-
# return if not interactive
11-
# https://www.gnu.org/software/bash/manual/html_node/Is-this-Shell-Interactive_003f.html
12-
#[ -z "$PS1" ] && return
13-
[[ ! "$-" =~ i ]] && return
9+
# shellcheck disable=SC1091
10+
[ -r "$HOME/.cache/sh_user_path" ] && source "$HOME/.cache/sh_user_path"
1411

15-
__main() {
16-
unset -f __main
12+
# shellcheck disable=SC1091
13+
source "$HOME/.bashrc.d/profile"
14+
15+
# return if not interactive
16+
# https://www.gnu.org/software/bash/manual/html_node/Is-this-Shell-Interactive_003f.html
17+
#[ -z "$PS1" ] && return
18+
[[ ! "$-" =~ i ]] && return
1719

1820
#-----------------------------------------------------------------------------
1921

2022
case "$OSTYPE" in
21-
darwin*)
22-
local -r os=macos
23-
;;
24-
linux*)
25-
local -r os=linux
26-
;;
27-
*)
28-
local -r os=
29-
;;
23+
darwin*) local -r os=macos ;;
24+
linux*) local -r os=linux ;;
25+
*) local -r os= ;;
3026
esac
3127

3228
# current session architecture

bash/.bashrc.d/path

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ __main() {
55
unset -f __main
66

77
case "$OSTYPE" in
8-
darwin*)
9-
local -r os=macos
10-
;;
11-
linux*)
12-
local -r os=linux
13-
;;
14-
*)
15-
local -r os=
16-
;;
8+
darwin*) local -r os=macos ;;
9+
linux*) local -r os=linux ;;
10+
*) local -r os= ;;
1711
esac
1812

1913
#-----------------------------------------------------------------------------
@@ -209,6 +203,12 @@ __main() {
209203
printf "export PATH='%s'\n" "$PATH"
210204
printf "export MANPATH='%s'\n" "$MANPATH"
211205
printf "export INFOPATH='%s'\n" "$INFOPATH"
206+
# App paths
207+
printf "export AQUA_GLOBAL_CONFIG='%s'\n" "$AQUA_GLOBAL_CONFIG"
208+
printf "export GHQ_ROOT='%s'\n" "$GHQ_ROOT"
209+
printf "export GOPATH='%s'\n" "$GOPATH"
210+
[ -n "$HOMEBREW_PREFIX" ] && printf "export HOMEBREW_PREFIX='%s'\n" "$HOMEBREW_PREFIX"
211+
[ -n "$PROTO_HOME" ] && printf "export PROTO_HOME='%s'\n" "$PROTO_HOME"
212212
} > "$HOME/.cache/sh_user_path"
213213
}
214214
__main "$@"

0 commit comments

Comments
 (0)