…One of the handy features of Bash is what's called a Here document.…This lets you specify input freely up to a specified limit…string, which can be handy for displaying long passages of text…in your script, or for specifying options to an interactive command,…like reading a command file, as we saw earlier in the chapter.…So, a Here document looks like this.…I use two less than symbols and a limit string to say,…Take all of this input and feed it into the given command.…In this case I'm just using cat up until you see the limit string.…Now obviously that limit string needs to be unique enough, that…it won't appear as part of whatever you're passing to the command.…So I'll save this and when I run it, I see the text that I entered.…
This is used a lot for instructions or other long bits…of text that would be tedious to echo out line by line.…And because of that, there's another option to know about.…If I put a dash after the less than symbols, bash…will strip out the leading tabs from the text that follows.…
- What is Bash?
- Managing output with grep, awk, and cut
- Understanding Bash script syntax
- Creating a basic Bash script
- Displaying text with "echo"
- Working with numbers, strings, and arrays
- Reading and writing text files
- Working with loops
- Using functions
- Getting user input during execution
- Ensuring a response
Skill Level Beginner
Linux: Bash Shell and Scriptswith Kevin Dankwardt2h 46m Intermediate
1. Working with the Command Line
2. Building Bash Scripts
3. Control Structures
4. Interacting with the User
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.