I was a running a bash script fine on one of the linux host(bash version version 3.2.25(1)), since I have moved the script to another host (bash verison version 4.2.25(1)) it is throwing warning as
line 36: warning: here-document at line 30 delimited by end-of-file (wanted `EOM') (wanted `EOM')
The code in question is:-(not sure how EOM works)
USAGE=$(cat <<EOM
Usage:${BASENAME} [-h] [-n] [-q]
-h, --help This usage message
-n, --dry-run
-q, --quiet
-d, --Destination
EOM)
}
I have made sure there is no space, tab or any special symbols before and after EOM as it was cause of error find during research on google.
bash (bash -x) debugged output looks like:-
+ source /test/test1/script.sh
./test.sh: line 36: warning: here-document at line 30 delimited by end-of-file
(wanted `EOM')
++ cat
+ USAGE='Usage:test [-h] [-n] [-q]
-h, --help This usage message
-n, --dry-run
-q, --quiet
-d, --Destination
This is sourcing a script.sh where usage is used in one of the function as: (However i guess this is not the cause of the error but may be I am wrong)-
show_usage()
{
declare -i rc=0
show_error "${@}"
rc=${?}
echo "${USAGE}"
exit ${rc}
}
Please help and getting rid of this warning and how this EOM working here exactly?