Skip to content

Commit 3b81aec

Browse files
authored
Update init-alpine.sh
1 parent 4c4ac9d commit 3b81aec

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/plugins/terminal/scripts/init-alpine.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,6 @@ if [ -f "/etc/profile" ]; then
144144
source "/etc/profile"
145145
fi
146146
147-
148-
if [ -f "$HOME/.bashrc" ]; then
149-
source "$HOME/.bashrc"
150-
fi
151-
152-
if [ -f /etc/bash/bashrc ]; then
153-
source /etc/bash/bashrc
154-
fi
155-
156147
# Environment setup
157148
export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/share/bin:/usr/share/sbin:/usr/local/bin:/usr/local/sbin
158149
@@ -161,7 +152,9 @@ export TERM=xterm-256color
161152
SHELL=/bin/bash
162153
export PIP_BREAK_SYSTEM_PACKAGES=1
163154
164-
# Smart path shortening function (fish-style: ~/p/s/components)
155+
# Default prompt with fish-style path shortening (~/p/s/components)
156+
# To use custom prompts (Starship, Oh My Posh, etc.), just init them in ~/.bashrc:
157+
# eval "$(starship init bash)"
165158
_shorten_path() {
166159
local path="$PWD"
167160
@@ -190,9 +183,17 @@ _shorten_path() {
190183
[[ "$path" == /* ]] && echo "/$result" || echo "$result"
191184
}
192185
193-
# Update prompt vars before each command
194186
PROMPT_COMMAND='_PS1_PATH=$(_shorten_path); _PS1_EXIT=$?'
195187
188+
# Source user configs AFTER defaults (so user can override PROMPT_COMMAND)
189+
if [ -f "$HOME/.bashrc" ]; then
190+
source "$HOME/.bashrc"
191+
fi
192+
193+
if [ -f /etc/bash/bashrc ]; then
194+
source /etc/bash/bashrc
195+
fi
196+
196197
197198
# Display MOTD if available
198199
if [ -s /etc/acode_motd ]; then
@@ -236,4 +237,4 @@ chmod +x "$PREFIX/alpine/initrc"
236237

237238
else
238239
exec "$@"
239-
fi
240+
fi

0 commit comments

Comments
 (0)