#!/usr/bin/env sh

OLDPWD=$(pwd)

cd "${HOME}" || return

for f in .zlogin .zlogout .zprofile .zshenv .zshrc .profile .shinit.sh .kshrc .sh_logout.sh; do
  zcompile "${f}"
  chmod ugo+rx,go-w "${f}" "${f}".zwc
done

case $(uname) in
  Linux*)
    for f in .profile.debian.sh .profile.redhat.sh .profile.ubuntu.sh; do
      if test -f "${f}"; then
        zcompile "${f}"
        chmod ugo+rx,go-w "${f}" "${f}".zwc
      fi
    done
    ;;
  *) ;;
esac

cd "${OLDPWD}" || return
