fix all spellsheck
This commit is contained in:
38
profile.sh
38
profile.sh
@@ -45,7 +45,7 @@ fi
|
||||
if ((BASH_VERSINFO[0] < 4)) || [[ ${BASH_VERSINFO[0]} -eq 4 && ${BASH_VERSINFO[1]} -lt 3 ]]; then
|
||||
echo "[ Error ] This profile requires Bash 4.3 or higher."
|
||||
echo "Current version: $BASH_VERSION"
|
||||
return 1 2>/dev/null || exit 1
|
||||
(return 0 2>/dev/null) && return 1 || exit 1
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -66,17 +66,17 @@ pathremove()
|
||||
export "$pathvar=$newpath"
|
||||
}
|
||||
|
||||
pathprepend()
|
||||
{
|
||||
[[ -z "$1" ]] && return 0
|
||||
local pathvar="${2:-PATH}"
|
||||
[[ "$pathvar" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]] || {
|
||||
printf "pathprepend: unsafe variable name '%s'\n" "$pathvar" >&2
|
||||
return 1
|
||||
}
|
||||
pathremove "$1" "$pathvar"
|
||||
export "$pathvar=$1${!pathvar:+:${!pathvar}}"
|
||||
}
|
||||
#pathprepend() # Unused for now, but might be useful in the future
|
||||
#{
|
||||
# [[ -z "$1" ]] && return 0
|
||||
# local pathvar="${2:-PATH}"
|
||||
# [[ "$pathvar" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]] || {
|
||||
# printf "pathprepend: unsafe variable name '%s'\n" "$pathvar" >&2
|
||||
# return 1
|
||||
# }
|
||||
# pathremove "$1" "$pathvar"
|
||||
# export "$pathvar=$1${!pathvar:+:${!pathvar}}"
|
||||
#}
|
||||
|
||||
pathappend()
|
||||
{
|
||||
@@ -98,7 +98,7 @@ parse_conf()
|
||||
{
|
||||
local config_file="$1"
|
||||
local current_section=""
|
||||
local line key value
|
||||
local key value
|
||||
|
||||
[[ ! -f "$config_file" ]] && return 1
|
||||
|
||||
@@ -140,6 +140,7 @@ parse_conf()
|
||||
|
||||
# Use a nameref for safe, eval-free assignment
|
||||
local -n current_array="CONF_$current_section"
|
||||
# shellcheck disable=SC2034 # Dynamic var creation
|
||||
current_array["$key"]="$value"
|
||||
fi
|
||||
done < "$config_file"
|
||||
@@ -168,6 +169,7 @@ load_alias()
|
||||
|
||||
# Only alias if the base command is executable
|
||||
if command -v "$base_cmd" >/dev/null 2>&1; then
|
||||
# shellcheck disable=SC2139 # Dynamic alias creation
|
||||
alias "$key"="$cmd"
|
||||
fi
|
||||
done
|
||||
@@ -204,10 +206,11 @@ load_conf()
|
||||
# Because we're more likely to be sourced, we use BASH_SOURCE to get the path
|
||||
# of the sourced file instead of $0
|
||||
if [[ -z "$PROFILE_PATH" ]]; then
|
||||
export MYPATH=$(dirname "$(realpath -s "${BASH_SOURCE[0]}")")
|
||||
MYPATH=$(dirname "$(realpath -s "${BASH_SOURCE[0]}")")
|
||||
else
|
||||
export MYPATH="$PROFILE_PATH"
|
||||
MYPATH="$PROFILE_PATH"
|
||||
fi
|
||||
export MYPATH
|
||||
if [[ ! -e "$MYPATH/profile.sh" ]]; then
|
||||
echo "[ Warning ] Path detection failed, trying to use pwd..."
|
||||
MYPATH=$(pwd)
|
||||
@@ -219,7 +222,8 @@ fi
|
||||
if [[ ! -s "$MYPATH/version" ]]; then
|
||||
echo "[ Warning ] Impossible to determine running version of profile, your installation might be broken."
|
||||
fi
|
||||
export PROFVERSION=$(cat "$MYPATH"/version)
|
||||
PROFVERSION=$(cat "$MYPATH"/version)
|
||||
export PROFVERSION
|
||||
|
||||
# Build PATH environment variable
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
@@ -262,7 +266,7 @@ if [[ $INTERACTIVE ]]; then
|
||||
# The value must match one of the alias names defined in SET_LOCALE so that
|
||||
# the corresponding set<alias> function exists after build_locale_shortcuts.
|
||||
if [[ -n "${DEFAULT_LANG:-}" ]]; then
|
||||
local _lang_fn="set${DEFAULT_LANG}"
|
||||
_lang_fn="set${DEFAULT_LANG}"
|
||||
if declare -F "$_lang_fn" >/dev/null 2>&1; then
|
||||
"$_lang_fn"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user