Last active
November 9, 2017 04:00
-
-
Save numpde/7e0bd69291369c980e0271d1e88798d4 to your computer and use it in GitHub Desktop.
Write [addpath PATH "/some/path"] instead of [export PATH="/some/path:$PATH"]
This file contains hidden or 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
#/bin/bash | |
# License-free | |
# Example: addpath PATH "/usr/bin" | |
addpath() { | |
varname=$1 | |
export $1="$2:${!varname}" | |
} | |
export X="/fake/path0" | |
echo Before: $X | |
addpath X "/fake/path1" | |
echo After : $X |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment