#!/bin/sh dir="$(pwd)" bin="$0" while [ -L "${bin}" ] do x="$(readlink "${bin}")" cd "$(dirname "${bin}")" bin="${x}" done cd "$(dirname "${bin}")" home="$(pwd)" cd "${dir}" if [ ! -z "${LUMEN_HOST}" ] then host="${LUMEN_HOST}" elif luajit -v > /dev/null 2>&1 then host=luajit elif lua -v > /dev/null 2>&1 then host=lua elif node -v > /dev/null 2>&1 then host=node else echo no host found fi case $host in node*) code=lumen.js export NODE_PATH="$NODE_PATH:${home}:${dir}/lib:${dir}/node_modules";; *) code=lumen.lua export LUA_PATH="$LUA_PATH;${home}/?.lua;${dir}/lib/?.lua;;";; esac exec ${host} "${home}/${code}" "$@"