Created
August 10, 2021 04:35
-
-
Save jaantollander/9084d066ca4f854593c9afc4695796d8 to your computer and use it in GitHub Desktop.
Adding to PATH in idempotent way, that is, without repetition.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://unix.stackexchange.com/a/124447 | |
add_to_path() { | |
case ":${PATH:=$1}:" in *:"$1":*) ;; *) PATH="$1:$PATH" ;; esac; | |
} | |
# Example | |
add_to_path $HOME/bin/julia-1.6.1/bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment