#!/usr/bin/env zsh # author: Daniel Sommer # license: MIT # exit on error set -e # check permissions [[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1 # check if script exists script="$(dirname $(realpath "$0"))/$(hostname).sh" [[ ! -x "$script" ]] && printf "error: script '"$script"' does not exist or is not executable!\n" >&2 && exit 1 # execute script printf ">> executing script '"$script"'...\n" . "$script"