Use heredoc correctly

This commit is contained in:
Paul Reeves 2023-02-28 16:05:57 +01:00
parent 057af0016d
commit e9e3d394c3

View File

@ -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" -- "$@") 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") EXECFILENAME=$(basename "$0")
BASENAME=$(basename "$0" .sh)
declare -i FIREBIRDMAJORVERSION=0 declare -i FIREBIRDMAJORVERSION=0
declare -i FIREBIRDMINORVERSION=0 declare -i FIREBIRDMINORVERSION=0
@ -44,50 +45,50 @@ declare -i FIREBIRDMINORVERSION=0
ShowHelp(){ ShowHelp(){
tabs 3,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77 tabs 3,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77
DOCNOTE=$(cat << MSG DOCNOTE=$(cat << MSG > ${BASENAME}-readme.md
\n
### $(basename $0)\n # $BASENAME
\t
\t\n
\tRun this script from a console prompt. It will execute ddl\n Run this script from a console prompt. It will execute ddl
\tto (re)create a firebird database.\n to (re)create a firebird database.
\t\n
\t\t -i | --input ALIASNAME \n -i | --input ALIASNAME
\t\t\t\tPass the name of the master script to execute.\n Pass the name of the master script to execute.
\t\t\t\tThis master script must have the same name as the alias used\n This master script must have the same name as the alias used
\t\t\t\tfor the database that is being worked on.\n for the database that is being worked on.
\t\n
\t\t\t\tIf the alias does not exist in alias.conf it will be added.\n If the alias does not exist in alias.conf it will be added.
\t\n
\t\t\t\t\t\$ALIAS = \$FIREBIRD_CONF\\\$ALIAS.fdb\n $ALIAS = \$FIREBIRD_CONF\\\$ALIAS.fdb
\t\n
\t\t\t\tNOTE: Do not add the script file type (.sql)\n NOTE: Do not add the script file type (.sql)
\t\n
### 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 MSG
) )
local _help=$BASE_NAME-readme.md local _help=$BASE_NAME-readme.md
echo -e $DOCNOTE > ${_help} #echo -e $DOCNOTE > ${_help}
cat ${_help} cat ${_help}
} }