#!/bin/bash if ! test -x "$1"; then echo "ERROR: call $0 path/script" 1>&2 exit 1 fi for f in hourly daily weekly monthly; do name=${1##*/} echo "installing $1 to /etc/cron.$f/${name%.*}" sudo cp $1 /etc/cron.$f/${name%.*} done