From e9e3d394c35b87375287c9965dce0958e0785018 Mon Sep 17 00:00:00 2001 From: Paul Reeves Date: Tue, 28 Feb 2023 16:05:57 +0100 Subject: [PATCH] Use heredoc correctly --- test/execsql.sh | 79 +++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/test/execsql.sh b/test/execsql.sh index e58fbf3..930e8de 100755 --- a/test/execsql.sh +++ b/test/execsql.sh @@ -37,6 +37,7 @@ todo() { GETOPT=$(getopt -o b:c:d:f:i:hs:u:p:z: --long firebirdbin:,firebirdconf:,firebirddb:,firebird:,input:,help,savedb:,user:,pass:,firebirdserverversion: -n "$0" -- "$@") EXECFILENAME=$(basename "$0") +BASENAME=$(basename "$0" .sh) declare -i FIREBIRDMAJORVERSION=0 declare -i FIREBIRDMINORVERSION=0 @@ -44,50 +45,50 @@ declare -i FIREBIRDMINORVERSION=0 ShowHelp(){ tabs 3,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77 -DOCNOTE=$(cat << MSG -\n -### $(basename $0)\n -\t -\t\n -\tRun this script from a console prompt. It will execute ddl\n -\tto (re)create a firebird database.\n -\t\n -\t\t -i | --input ALIASNAME \n -\t\t\t\tPass the name of the master script to execute.\n -\t\t\t\tThis master script must have the same name as the alias used\n -\t\t\t\tfor the database that is being worked on.\n -\t\n -\t\t\t\tIf the alias does not exist in alias.conf it will be added.\n -\t\n -\t\t\t\t\t\$ALIAS = \$FIREBIRD_CONF\\\$ALIAS.fdb\n -\t\n -\t\t\t\tNOTE: Do not add the script file type (.sql)\n -\t\n +DOCNOTE=$(cat << MSG > ${BASENAME}-readme.md + +# $BASENAME + + + Run this script from a console prompt. It will execute ddl + to (re)create a firebird database. + + -i | --input ALIASNAME + Pass the name of the master script to execute. + This master script must have the same name as the alias used + for the database that is being worked on. + + If the alias does not exist in alias.conf it will be added. + + $ALIAS = \$FIREBIRD_CONF\\\$ALIAS.fdb + + NOTE: Do not add the script file type (.sql) + + +### Options + + Other available parameters: + + -f | --firebirdconf a/path/to/firebird/conf files + Assign a path to the FIREBIRD_CONF variable + Default is /opt/firebird + + -d | --firebirddb a/path/to/firebird/db + Assign a path to the FB_DATA variable + Default is /srv/data/ + + -s | --savedb /a/backup/dir + Do a gbak backup of the existing db before executing ddl + + -h | --help + This help screen. + -### Options\n -\t\n -\t Other available parameters:\n -\t\n -\t\t -f | --firebirdconf a/path/to/firebird/conf files\n -\t\t\t\tAssign a path to the FIREBIRD_CONF variable\n -\t\t\t\tDefault is /opt/firebird\n -\t\n -\t\t -d | --firebirddb a/path/to/firebird/db\n -\t\t\t\tAssign a path to the FB_DATA variable\n -\t\t\t\tDefault is /srv/data/\n -\t\n -\t\t -s | --savedb /a/backup/dir \n -\t\t\t\tDo a gbak backup of the existing db before executing ddl\n -\t\n -\t\t -h | --help\n -\t\t\t\tThis help screen.\n -\t\n -\t\n MSG ) local _help=$BASE_NAME-readme.md -echo -e $DOCNOTE > ${_help} +#echo -e $DOCNOTE > ${_help} cat ${_help} }