my code is always stopping after ENDOFSQL; How to resolve this Problem and print the last echo?
#!/bin/bash
sqlplus db/pass << ENDOFSQL
@script.sql
exit;
ENDOFSQL;
echo -e "text"
my code is always stopping after ENDOFSQL; How to resolve this Problem and print the last echo?
#!/bin/bash
sqlplus db/pass << ENDOFSQL
@script.sql
exit;
ENDOFSQL;
echo -e "text"
You must remove the semicolon ; at the end of ENDOFSQL;. Otherwise, your here document extends until the end of file and ENDOFSQL; and echo is part of the here document
#!/bin/bash
sqlplus db/pass << ENDOFSQL
@script.sql
exit;
ENDOFSQL
echo -e "text"
See Here Documents for details
The format of here-documents is:
<<[-]word here-document delimiterThis type of redirection instructs the shell to read input from the current source until a line containing only word (with no trailing blanks) is seen. All of the lines read up to that point are then used as the standard input for a command.