[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: getlua.sh - the fastest way to get a Lua interpreter on any Linux server
- From: William Ahern <william@...>
- Date: Mon, 4 Mar 2013 11:30:12 -0800
On Sun, Mar 03, 2013 at 09:24:45PM +0100, Stefan Reich wrote:
> Hey ho Lua folk!
>
> If you start a SourceForge project, you get shell access automatically
> (http://sourceforge.net/apps/trac/sourceforge/wiki/Shell%20service).
> Which is nice.
>
> But there's no Lua on the system. Here's the fastest way to get an
> interpreter after you logged in to the shell:
>
> wget luaos.net/getlua.sh && sh getlua.sh
Unfortunately wget is far from universally available. Here's a simple shell
function which should work on most Linux, OS X, *BSD, and Solaris systems:
# 1) GNU wget
# 2) curl
# 3) GET - from Perl LWP
# 4) ftp - BSD ftp(1) can fetch, but Linux NetKit's fork is too old
fetch() {
URL="${1}"
FILE=${2:-${URL##*/}}
if [ -n "$(command -v wget)" ]; then
wget -O "${FILE}" "${URL}";
elif [ -n "$(command -v curl)" ]; then
curl -o "${FILE}" "${URL}";
elif [ -n "$(command -v GET)" ]; then
GET "${URL}" > "${FILE}";
elif [ -n "$(command -v ftp)" ]; then
ftp -o "${FILE}" "${URL}";
else
echo "unable to fetch ${URL}" >&2;
fi
}