diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-12-03 10:12:46 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-12-03 10:12:46 +0200 |
commit | fb21c7fceab24c7ecd7a9aaf89e6203cf242a38e (patch) | |
tree | b4757a5a846f3635d372543d5923d48e9116c157 /bashrc | |
parent | af381c1638a8a6f421ebefdae6eca6963c167fc6 (diff) | |
download | liw-dot-files-fb21c7fceab24c7ecd7a9aaf89e6203cf242a38e.tar.gz |
bashrc: de-duplicate $PATH if pathdeup is available
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Sponsored-by: author
Diffstat (limited to 'bashrc')
-rw-r--r-- | bashrc | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -147,7 +147,7 @@ prompt_set_window_title() { prompt_command() { tell_about_exit_code "$?" PS1="$(define_ps1)" - prompt_set_window_title + prompt_set_window_title } ############### @@ -155,10 +155,9 @@ prompt_command() { ulimit -c 0 umask 002 - # Get environment variables from systemd, if any are set. -if systemctl --user show-environment > /dev/null 2>&1; then - . <(systemctl --user show-environment | sed 's/^/export /') +if systemctl --user show-environment >/dev/null 2>&1; then + . <(systemctl --user show-environment | sed 's/^/export /') fi if command -v emacs >/dev/null; then @@ -181,7 +180,6 @@ export ANSIBLE_STDOUT_CALLBACK=yaml export PYTHONDONTWRITEBYTECODE=1 export STARSHIP_CONFIG=~/.config/starship/config.toml - if [ -e "$HOME/tmp/cargo" ]; then export CARGO_TARGET_DIR="$HOME/tmp/cargo" elif [ -e "$HOME/cargo" ]; then @@ -189,7 +187,7 @@ elif [ -e "$HOME/cargo" ]; then fi if [ -e "$HOME/tmp" ]; then - export TMPDIR="$HOME/tmp" + export TMPDIR="$HOME/tmp" fi PROMPT_DIRTRIM=1 @@ -200,21 +198,24 @@ if [ -n "$PS1" ]; then fi gotcmd() { - command -v "$1" > /dev/null + command -v "$1" >/dev/null } if gotcmd zoxide; then - eval "$(zoxide init bash)" + eval "$(zoxide init bash)" fi if gotcmd starship; then - export PROMPT_COMMAND=prompt_set_window_title - eval "$(starship init bash)" + export PROMPT_COMMAND=prompt_set_window_title + eval "$(starship init bash)" else - export PROMPT_COMMAND=prompt_command + export PROMPT_COMMAND=prompt_command +fi + +if [ -e "$HOME/.cargo/env" ]; then + . "$HOME/.cargo/env" fi -if [ -e "$HOME/.cargo/env" ] -then - . "$HOME/.cargo/env" +if command -v pathdedup >/dev/null; then + export PATH="$(pathdedup)" fi |