Introduction Overview Documentation Summary Sourceforge Download

ShellSQL - SQL for Shell Scripts

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/sh

HANDLE=`shpostgres dbname=mydb`

shsql $HANDLE "begin"

for ARG in $*
do

        shsql $HANDLE "insert into mytable (fld1, fld2)" \
                       "values (nextval('myseq'), '$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.

The following database engines are supported...
  1. PostgreSQL
  2. MySQL
  3. SQLite3
  4. Unix ODBC
  5. FreeTDS
More may well be added if people request them.

The software can be downloaded from here. There is also some detailed documentation as well as a brief usage summary of the commands.

The programs sares released under the GNU Public License.

If you have problems, or find bugs, please email me on edddy@edlsystems.com, if there is sufficient interest I will start a mailing list.

Enjoy

Version History
~~~~~~~~~~~~~~~

version 0.7.3 - 7-May-05 - Bug fix in sarg.c and shsqlinp.c and install.sh
Version 0.7.2 - 07-May-05 - Bug fix for shsql
Version 0.7.1 - 31-January-05 - Bug fix for shmysql
Version 0.7 - 30-January-05 - Included following:
            - Addition of freetds engine for MS-SQL and Sybase
            - included of --csv, --pipe, --colon, --tab and --shell output
              formatting commands to shsql
            - Added shsqlinp routine
            - General bug fixes/tidy ups
Version 0.6 - 10-November-04 - General tidy up of code
Version 0.5 - 6-November-04 - Repackaged tar file
Version 0.4 - 5-November-04 - Fixed message.h
Version 0.3 - 5-November-04 - Corrected documentation errors
Version 0.2 - 4-November-04 - First published
SourceForge.net Logo