Bash is a powerful command-line interpreter with many options. Discover where to go to consult the help documentation.
- [Instructor] Perhaps the best way to start talking about Bash scripting is, how to find out more information about Bash. So you know in Linux it's common to have documentation on your system in man pages and info pages, and typically there's man page and info page for Bash, and the info page is usually longer. Bash has lots and lots and lots of features, and so, it's really handy to be able to look up details. Course you could do web searches, as well as the full manual is available online from the GNU site.
So let's check out the man pages, and info page, for Bash. So if we do man bash, usual man command, we see, it shows up in section one, which means commands, so this is some documentation about the Bash command options and so forth. If we check how many lines that is, by doing a word count -l for lines there, it's a little over 5,000 lines, that's a fair amount of information. If we check out the info for Bash, we get the info interface, which is kind of hyperlinked, you don't use your mouse, you use terminal keys, but you can jump around, you can search for things, say we search for test, and it skips ahead to the first incidence of that string, and we could keep searching or search for other things and so forth.
And the info pages have quite a bit of good information, to compare, there's about 9,500 lines of information in the info page for Bash, that's quite a bit of stuff. And then for lots of details, we can look at the webpage. So here in the web, we see the manual for Bash, what a spartan page. We can see lots of great stuff, there's even a little section on shell scripts, but this reference I think you might find pretty valuable.
- Exploring the Bash documentation
- Setting the script interpreter and permissions
- Sourcing and aliasing with bash
- Displaying text with echo
- Using the typeset and declare commands for variables
- Reading input
- Defining functions
- Using operators
- Using filters and parameter expansion
- Advanced bash scripting techniques