12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #!/bin/zsh
- #
- # Vim scripts updates
- #
- set -A vim_scripts \
- "https://github.com/Jonty/phplint.vim/raw/master/phplint.vim" \
- "http://git.openics.org/cgit.cgi/bindzoneedit.vim/plain/bindzoneedit.vim"
- vim_scripts_update() {
- local ret=0
- if which wget &>/dev/null; then
- for i in {1..${#vim_scripts}} ; do
- local script=$vim_scripts[$i]
- local script_name=$(basename "$script")
- local script_path=${HOME}/.vim/plugin/${script_name}
- local script_path_temp=${script_path}.new
- echo -n "Upgrading “${script_name}” from $script ... "
- echo "\"" > "${script_path_temp}"
- echo "\" script downloaded from ${script}" >> "${script_path_temp}"
- echo "\"" >> "${script_path_temp}"
- echo "" >> "${script_path_temp}"
- wget --no-check-certificate -q "$script" -O - >> "${script_path_temp}"
- if [ $? = 0 ]; then
- if [ -r "${script_path}" ]; then
- rm -f "${script_path}"
- fi
- mv "${script_path_temp}" "${script_path}"
- echo "done"
- else
- echo "fail"
- ret=1
- fi
- rm -f "${script_path_temp}"
- done
- else
- echo "Can't find “wget” (not in path or installed?)."
- ret=1
- fi
- return ret
- }
|