Article 59GWG [SOLVED] bash script - end line with a ;

[SOLVED] bash script - end line with a ;

by
GPGAgent
from LinuxQuestions.org on (#59GWG)
Okay, just when you think you understand the syntax, something happens that make you question everything.
Well a bit over dramatic, I've found a very simple bit of bash script that needs to end each line with a semi-colon.
Here;'s the snip:Code:#!/bin/bash
set -e
set -u
set -o pipefail
# #########################
# set some default values #
# #########################
SCRIPTNAME=$(basename ${0%.*})
ENCODE="NO ENCODE"
DIRECTORYNAME="TEMPBACKUP"
SRC="/dev/sr0"
#############
# functions #
#############

USAGE() { echo -e "Usage: $SCRIPTNAME [-w <in-dir>] [-o <out-dir>] [-c <template1>] [-t <template2>] \n" 1>&2; }
if (($# == 0))
then
USAGE; exit 1;
fi

USAGE_HELP() {
USAGE;
echo "Help";
echo "====";
echo " -b: BankName";
echo " -r: Region";
echo " -w: Windowdate";

}This works fine when USAGE echo line ends with a ;Code:dev$ ./DVDOpts.sh
Usage: DVDOpts [-w <in-dir>] [-o <out-dir>] [-c <template1>] [-t <template2>]Remove it and it falls through to the end:
Code:USAGE() { echo -e "Usage: $SCRIPTNAME [-w <in-dir>] [-o <out-dir>] [-c <template1>] [-t <template2>] \n" 1>&2 }like this:

Code:dev$ ./DVDOpts.sh
./DVDOpts.sh: line 125: syntax error: unexpected end of fileThere may well be further errors in the script but why do I need the semi-colon?latest?d=yIl2AUoC8zA latest?i=mPz18VobQ-k:P3x8bEGbCYM:F7zBnMy latest?i=mPz18VobQ-k:P3x8bEGbCYM:V_sGLiP latest?d=qj6IDK7rITs latest?i=mPz18VobQ-k:P3x8bEGbCYM:gIN9vFwmPz18VobQ-k
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments