Output, Assign, Pipe and Redirect a Heredoc in a Shell Script
You may want to use this when working with multi-line strings or strings with mixed quotes.
Hit the subscribe button to receive more videos like this!
REFERENCE LINKS
---------------------------------------------------
► nickjanetakis.com/blog/output...
► stackoverflow.com/a/1655389
COURSES
---------------------------------------------------
Courses I've created that focus on web dev and deployment topics.
► nickjanetakis.com/courses/
THE TOOLS I USE / GEAR
---------------------------------------------------
► nickjanetakis.com/blog/the-to...
FOLLOW ME ELSEWHERE
---------------------------------------------------
► Twitter: / nickjanetakis
► GitHub: github.com/nickjj
TIMESTAMPS
---------------------------------------------------
0:00 -- Intro
0:20 -- A run down on heredocs
2:56 -- Avoiding variable or expression interpolation
4:31 -- Assigning a multi-line string to a variable with cat vs read
7:19 -- Piping a heredoc to another command as input
8:20 -- Piping things into kubectl where it expects a file as input
10:04 -- Doing the same as before but with curl
11:14 -- Redirecting a multi-line string to a file
Пікірлер: 9
Thank you for showing how to avoid variable expansion! 👍 That often trips me up.
I love your shell scripts contents
Thanks!
@NickJanetakis
3 ай бұрын
Anytime, thanks a lot for the tip, I really appreciate it!
Awesome
Thanks for the video. Why didn't you mention
@NickJanetakis
3 ай бұрын
I have an awareness of it but it has never come up in anything I've done. It's only for stripping leading tab characters right? Most set ups and code formatting tools will convert tabs to spaces. Am I missing something?
@nnutipa
3 ай бұрын
@@NickJanetakis Yes, you must use tabs, but I am not sure about tab conversion to spaces. Afaik, if you don't want this to happen you can turn this functionality off in almost every text editor.
@NickJanetakis
3 ай бұрын
@@nnutipa Right, I mean in almost all cases I've seen while working for and with folks, there has been a general census to replace tabs with spaces at the code editor level and it's also sometimes enforced by code formatting tools for specific languages. The only exception has been for files that require hard tabs like a Makefile.