-
-
Save andrewcrook/6e60d1c4799c9dab9af25d4f12b1e3da 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