What is EOF in a shell script

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarANKUSH THAVALI
  • 10 Sep, 2023
  • 0 Comments
  • 28 Secs Read

What is EOF in a shell script

What is EOF in a shell script

Basically <<EOF tells the shell that you are going to enter a multiline string until the “tag” EOF.

Example :

sqlplus / as sysdba <<EOF
select name, open_mode from v$database;

archive log list;

EOF

 

 

Save EOF Output :

You can save the EOF output to another file

sqlplus / as sysdba << EOF > out.log

select name, open_mode from v$database;

archive log list;

EOF

This will create a new file out.log in current location which will contain output sql queries.