# to add several directories (e.g. ~/bin and ~/scripts)
# to `$PATH` for the respective user
set_path() {
  # check if user id is 1000 or higher
  # [ "$(id -u)" -ge 1000 ] || return

  for i in "${@-}"; do
    # check if the directory exists
    [ -d "${i}" ] || continue

    # check if it is not already in your $PATH.
    echo "${PATH}" | grep -Eq "(^|:)${i}(:|$)" && continue

    # then append it to $PATH and export it
    export PATH="${PATH}:${i}"
  done
}
