diff options
author | 2013-11-03 21:21:21 +0100 | |
---|---|---|
committer | 2013-11-03 21:21:21 +0100 | |
commit | 5c6cd059e8395d7f24d4b199e59c8c2f562dc438 (patch) | |
tree | 2e108e0724b5f5248de11c515312fa8c7c04ab4c /zsh/.zsh/functions/add-to-list | |
parent | cca8771d855a3c8ba67bcb43a45967d9e4b6dd15 (diff) | |
download | dotfiles-5c6cd059e8395d7f24d4b199e59c8c2f562dc438.tar.gz dotfiles-5c6cd059e8395d7f24d4b199e59c8c2f562dc438.zip |
New stow hierarchy
Diffstat (limited to 'zsh/.zsh/functions/add-to-list')
-rw-r--r-- | zsh/.zsh/functions/add-to-list | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/zsh/.zsh/functions/add-to-list b/zsh/.zsh/functions/add-to-list new file mode 100644 index 0000000..18720e0 --- /dev/null +++ b/zsh/.zsh/functions/add-to-list @@ -0,0 +1,10 @@ +# -*- 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 |