Add .bash_profile to avoid dup $HOME/bin in PATH(stupid Debian)

This commit is contained in:
2024-01-20 19:12:04 +01:00
parent 9801503eab
commit 11b7cf40eb
3 changed files with 31 additions and 4 deletions

17
config/home/.bash_profile Normal file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
#
# ~/.bash_profile - bash login script.
#
# (C) Bruno Raoult ("br"), 2024
# Licensed under the GNU General Public License v3.0 or later.
# Some rights reserved. See COPYING.
#
# You should have received a copy of the GNU General Public License along with this
# program. If not, see <https://www.gnu.org/licenses/gpl-3.0-standalone.html>.
#
# For login shells, ~/.profile is executed. Debian default one does:
# 1) source .bashrc if it exists
# 2) add "$HOME"/bin in PATH
# This imply a duplicate "$HOME/bin" in PATH, as we do everything in .bashrc.$user.
[ -f "$HOME/.bashrc" ] && . "$HOME/.bashrc"

View File

@@ -2,7 +2,7 @@
#
# ~/.bashrc.br - user specific initialization
#
# (C) Bruno Raoult ("br"), 2001-2023
# (C) Bruno Raoult ("br"), 2001-2024
# Licensed under the GNU General Public License v3.0 or later.
# Some rights reserved. See COPYING.
#
@@ -14,6 +14,12 @@
# Usage: to be invoked from .bashrc.
# i.e., add at the end of .bashrc:
# [ -f "$HOME/.bashrc.$USER" ] && . "$HOME/.bashrc.$USER"
#
# Debian default ~/.profile does:
# 1) source .bashrc if it exists
# 2) add "$HOME"/bin in PATH
# This imply a duplicate "$HOME/bin" in PATH, as we do everything here.
# Better to have a ~/.bash_profile with the lines above.
# _var_del() - remove an element from a colon-separated list.
# $1: name (reference) of a colon separated list

View File

@@ -2,7 +2,7 @@
#
# ~/.bashrc.br.lorien - host specific initialization
#
# (C) Bruno Raoult ("br"), 2001-2023
# (C) Bruno Raoult ("br"), 2001-2024
# Licensed under the GNU General Public License v3.0 or later.
# Some rights reserved. See COPYING.
#
@@ -44,17 +44,21 @@ fi
# The alias, when invoked, will:
# (1) change working directory to $1
# (2) source $3 when $3 is not '-'. $3 path can be relative (preferred), or
# absolute. If $3 is "+", it will default to "./scripts/env.sh".
# absolute. If $3 is "+", it will default to "scripts/env.sh".
#
# Examples:
# _vardir MYDIR mydir - ~/foo/mydirprj
_vardir() {
local _v="$1" _a="$2" _s="$3" _p="$4"
if [[ ! -d $_p ]]; then
printf "ignored project: %s\n" "$_p"
return 0
fi
local _x="cd $_p"
export "$_v"="$_p"
case "$_s" in
-) ;;
+) _s="./scripts/env.sh" ;&
+) _s="scripts/env.sh" ;&
*) if [[ -r "$_p/$_s" ]]; then
_x+="; . $_s"
else