Created
September 22, 2021 19:41
-
-
Save crabdancing/804bba39da7b810aa82a4b065fe5cb67 to your computer and use it in GitHub Desktop.
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
# TODO: replace with mechanism that rearranges existing | |
while read line; do | |
case "$line" in | |
''|\#*) continue ;; # skip blanks | |
esac # Stolen from: https://unix.stackexchange.com/questions/244465/how-to-make-bash-built-in-read-ignore-commented-or-empty-lines | |
# Expand tilda | |
line=${line/#\~/$HOME} | |
# If exists (as directory) | |
if [ -d "$line" ]; then | |
# If isn't in PATH | |
if [[ :$PATH: != *:"$line":* ]]; then | |
# Add to PATH and export | |
export PATH="$PATH:$line" | |
fi | |
fi | |
done < /etc/paths |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment