krm9_q
Last Updated: January 16, 2019
·
1.941K
· ezkl

Use HEREDOC in shells

You can use HEREDOC blocks from the *NIX shell:

$ cat <<EOF > randofosho
heredoc> $RANDOM 
heredoc> EOF
$ cat randofosho 
15816

No more newline madness!

1 Response
Add your response

1547

What the difference between << and <<-? I can never remember…

12:34am passcod:~$ cat <<D 
heredoc> a                 
heredoc> b                 
heredoc> c                 
heredoc> D                 
a                          
b                          
c                          
12:34am passcod:~$ cat <<-D
heredocd> a                
heredocd> b                
heredocd> c                
heredocd> D                
a                          
b                          
c                          
over 1 year ago ·