Skip to content

Instantly share code, notes, and snippets.

@jegade
Last active August 29, 2015 14:18
Show Gist options
  • Save jegade/ae649da999d7daf72a09 to your computer and use it in GitHub Desktop.
Save jegade/ae649da999d7daf72a09 to your computer and use it in GitHub Desktop.
#!/bin/bash
# If this script is running as /usr/local/bin/perlbrew-cron
# then you would need to have a crontab something like:
#
# MAILTO=you@example.com
# PATH=$PATH:/usr/local/bin
# 0 * * * * perlbrew-cron ~/path/to/perl_cron.pl arg1 'arg 2' arg3
export PERLBREW_ROOT=${PERLBREW_ROOT:=/opt/perl5}
export PERLBREW_HOME=${PERLBREW_HOME:=$HOME/.perlbrew}
builtin source ${PERLBREW_HOME}/init
export PATH=$PERLBREW_PATH:$PATH:/bin
builtin source ${PERLBREW_ROOT}/etc/bashrc
_cmd="$1"
shift
_args="'$1'"
shift
for i in "$@"
do
_args="${_args} '$i'"
done
_command="perl $_cmd $_args"
bash -c "$_command"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment