.lib/bash/path.sh

Fri, 09 Mar 2018 00:24:31 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 09 Mar 2018 00:24:31 -0500
changeset 698
e5389e9fdb82
parent 687
17d2d3c6042e
permissions
-rw-r--r--

less magic

path-append() {
  if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
    PATH="${PATH:+"$PATH:"}$1"
    return 0
  fi
  return 1
}

path-prepend() {
  if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
    PATH="$1${PATH:+":$PATH"}"
    return 0
  fi
  return 1
}

mercurial