#!/bin/bash -e

#
# idgames.sh - simple idgames API ping script
#

base='http://www.doomworld.com/idgames/api/api.php'
json='&out=json'
action='?action='

function ping ()
{
    curl -X GET "${base}${action}ping${json}";
}

case "$1" in
    ping)
        ping
        ;;
    *)
        echo "Command \"${1}\" not recognized"
        exit 1
        ;;
esac


#!/bin/bash -e

#
# idgames.sh - simple idgames API ping script
#
# Usage
#   ./idgames.sh [db]ping
#

base='http://www.doomworld.com/idgames/api/api.php'
json='&out=json'
action='?action='

function ping ()
{
    uri="${base}${action}${1}${json}";
    echo "Accessing $uri";
    curl -X GET $uri;
}

case "$1" in
    ping|dbping)
        ping $1
        ;;
    *)
        echo "Command \"${1}\" not recognized"
        exit 1
        ;;
esac


Add ability to ping db
Add ability to ping db

While here, make ping function more reusable
