ShellSQL - SQL for shell scripts

Posted on September 16, 2008 in General News

ShellSQL is a suite of programs designed to enable LINUX/UNIX shell scripts to connect to SQL engines and execute SQL queries and commands in a simple way enabling intergration with the rest of the script. For example, it can do things like..
#/bin/shHANDLE=`shpostgres dbname=mydb`

shsql $HANDLE "begin"

for ARG in $

do

shsql $HANDLE "insert into mytable fld1, fld2" \

"values nextvalmyseq, $ARG"

done

shsql $HANDLE "commit"

if [ $# -gt 0 ]

then

ROWS=`shsql $HANDLE "select count from mytable"`

echo "No of rows now in table is" $ROWS

fi

shsqlend $HANDLE

For details on how it hangs together have a look at the overview.