Shell – Linux for $DECK and $EOD

scriptingshell

In VMS DCL one may embed data in a command file using $DECK and $EOD. What is Linux for this?

Best Answer

You can embed data within shell scripts. How this works is shell dependent. However bash/perl etc. do this in similar ways, using a heredoc. e.g. in bash (and similar):

$ cat > sample.txt << EOF
a
b
c
EOF

will write as input a,b,c up to the EOF, and then cat will write that out to sample.txt. Note that EOF is a convention and you can use any label. Try the above on the command line to see more clearly what's going on.

Related Question