Skip to content

Commit 1f6d0d5

Browse files
committed
Default empty value for variable not defined
1 parent 39f60ff commit 1f6d0d5

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

themes/barbuk/barbuk.theme.bash

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ function __exit_prompt() {
118118
}
119119

120120
function __aws_profile_prompt() {
121-
if [[ -n "${AWS_PROFILE}" ]]; then
121+
if [[ -n "${AWS_PROFILE:-}" ]]; then
122122
echo -n "${bold_purple?}${AWS_PROFILE_CHAR}${normal?}${AWS_PROFILE} "
123123
fi
124124
}
125125

126126
function __scaleway_profile_prompt() {
127-
if [[ -n "${SCW_PROFILE}" ]]; then
127+
if [[ -n "${SCW_PROFILE:-}" ]]; then
128128
echo -n "${bold_purple?}${SCALEWAY_PROFILE_CHAR}${normal?}${SCW_PROFILE} "
129129
fi
130130
}
@@ -189,9 +189,9 @@ function __ssh_prompt() {
189189

190190
function __python_venv_prompt() {
191191
local python_info=""
192-
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
192+
if [[ -n "${CONDA_DEFAULT_ENV:-}" ]]; then
193193
python_info="${CONDA_DEFAULT_ENV}"
194-
elif [[ -n "${VIRTUAL_ENV_PROMPT}" ]]; then
194+
elif [[ -n "${VIRTUAL_ENV_PROMPT:-}" ]]; then
195195
python_info="${VIRTUAL_ENV_PROMPT}"
196196
elif [[ -f pyproject.toml ]]; then
197197
python_info=$(awk -F'"' '/^requires-python/ {print $2}' pyproject.toml)
@@ -286,7 +286,7 @@ function __ansible_prompt() {
286286
# /etc/ansible/ansible.cfg
287287
#
288288
# Ansible will process the above list and use the first file found, all others are ignored.
289-
if [ -n "$ANSIBLE_CONFIG" ]; then
289+
if [ -n "${ANSIBLE_CONFIG:-}" ]; then
290290
config="$ANSIBLE_CONFIG"
291291
elif [ -f ansible.cfg ]; then
292292
config=ansible.cfg
@@ -297,15 +297,15 @@ function __ansible_prompt() {
297297
config="/etc/ansible/ansible.cfg"
298298
fi
299299

300-
if [ -n "$config" ]; then
300+
if [ -n "${config:-}" ]; then
301301
echo "${bold_purple?}${ANSIBLE_CHAR}${normal?}${config} "
302302
fi
303303
}
304304

305305
function __prompt-command() {
306306
exit_code="$?"
307307
command_duration=$(_command_duration)
308-
local wrap_char
308+
local wrap_char=
309309

310310
# Generate prompt
311311
PS1="\n "

0 commit comments

Comments
 (0)