theme/essential: s/echo/printf/g
parent
3695862b43
commit
f2dcb2aff6
|
|
@ -1,7 +1,7 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
function _user-prompt() {
|
function _user-prompt() {
|
||||||
local -r user='\\u'
|
local -r user='\u'
|
||||||
|
|
||||||
if [[ "${EUID}" -eq 0 ]]; then
|
if [[ "${EUID}" -eq 0 ]]; then
|
||||||
# Privileged users:
|
# Privileged users:
|
||||||
|
|
@ -12,11 +12,11 @@ function _user-prompt() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Print the current user's name (colored according to their current EUID):
|
# Print the current user's name (colored according to their current EUID):
|
||||||
echo -ne "${user_color}${user}${normal?}"
|
printf '%b%s%b' "${user_color}" "${user}" "${normal?}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _host-prompt() {
|
function _host-prompt() {
|
||||||
local -r host='\\h'
|
local -r host='\h'
|
||||||
|
|
||||||
# Check whether or not $SSH_TTY is set:
|
# Check whether or not $SSH_TTY is set:
|
||||||
if [[ -z "${SSH_TTY:-}" ]]; then
|
if [[ -z "${SSH_TTY:-}" ]]; then
|
||||||
|
|
@ -28,13 +28,13 @@ function _host-prompt() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Print the current hostname (colored according to $SSH_TTY's status):
|
# Print the current hostname (colored according to $SSH_TTY's status):
|
||||||
echo -ne "${host_color}${host}${normal?}"
|
printf '%b%s%b' "${host_color}" "${host}" "${normal?}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _user-at-host-prompt() {
|
function _user-at-host-prompt() {
|
||||||
# Concatenate the user and host prompts into: user@host:
|
# Concatenate the user and host prompts into: user@host:
|
||||||
_user-prompt
|
_user-prompt
|
||||||
echo -ne "${bold_white?}@"
|
printf '%b@' "${bold_white?}"
|
||||||
_host-prompt
|
_host-prompt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,26 +53,25 @@ function _exit-status-prompt() {
|
||||||
local -r exit_status_color="${bold_red?}"
|
local -r exit_status_color="${bold_red?}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -ne "${exit_status_color}"
|
|
||||||
if [[ "${prompt_string}" -eq 1 ]]; then
|
if [[ "${prompt_string}" -eq 1 ]]; then
|
||||||
# $PS1:
|
# $PS1:
|
||||||
echo -ne " +${normal?} "
|
printf '%b +%b' "${exit_status_color}" "${normal?} "
|
||||||
elif [[ "${prompt_string}" -eq 2 ]]; then
|
elif [[ "${prompt_string}" -eq 2 ]]; then
|
||||||
# $PS2:
|
# $PS2:
|
||||||
echo -ne " |${normal?} "
|
printf '%b |%b' "${exit_status_color}" "${normal?} "
|
||||||
else
|
else
|
||||||
# Default:
|
# Default:
|
||||||
echo -ne " ?${normal?} "
|
printf '%b ?%b' "${exit_status_color}" "${normal?} "
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _ps1() {
|
function _ps1() {
|
||||||
local -r time='\\t'
|
local -r time='\t'
|
||||||
local -r pwd='\\w'
|
local -r pwd='\w'
|
||||||
|
|
||||||
echo -ne "${bold_white?}${time} "
|
printf '%b%s ' "${bold_white?}" "${time}"
|
||||||
_user-at-host-prompt
|
_user-at-host-prompt
|
||||||
echo -e "${bold_white?}:${normal?}${pwd}"
|
printf '%b:%b%s\n' "${bold_white?}" "${normal?}" "${pwd}"
|
||||||
_exit-status-prompt 1 "${exit_status}"
|
_exit-status-prompt 1 "${exit_status}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue