I am starting with Linux bash scripting and I have found a bash script which uses:
my_command << OMG
..rest_of_commands
OMG
What does this OMG
means? I have been searching about it but I did not found any information about it.
Thank you.
I am starting with Linux bash scripting and I have found a bash script which uses:
my_command << OMG
..rest_of_commands
OMG
What does this OMG
means? I have been searching about it but I did not found any information about it.
Thank you.
That's known as a here-doc (so now you can investigate further), it basically takes everything up to (but excluding) the OMG
line and provides it as standard input to the my_command
executable.
The OMG
is any string that must match between the two areas and there are ways to allow for tabs and spaces to be ignored at the start of each line, but the basic concept is as I've described.
The following transcript shows it in action, where cat
is used to copy standard input to standard output:
pax:~$ cat <<XYZZY
> hello
> there
> XYZZY
hello
there