legacy-dotfiles/.zsh/functions/add-to-list
Tom Willemse 370726e0cc Move PATHS to .zshrc
And use a new function to make it clean
2013-04-24 02:43:56 +02:00

10 lines
223 B
Bash

# -*- mode: sh; -*-
if [[ ! "${(P)${1}}" =~ (^|:)"$2"(:|$) ]]; then
if [ -n "$3" ]; then
# Append
typeset -g $1="${(P)${1}}:$2"
else
# Prepend
typeset -g $1="$2:${(P)${1}}"
fi
fi