From the course: LPIC-1 Exam 102 (Version 5.0) Cert Prep
Introduction to Bash - Linux Tutorial
From the course: LPIC-1 Exam 102 (Version 5.0) Cert Prep
Introduction to Bash
- Bash is the Default shell on Enterprise Linux, and as such, is the default vehicle for Shell Scripts. As of this recording, the version of Bash that comes with Enterprise Linux seven, is four dot two. Older versions of Linux may target an older version of Bash, or even call the lowest common denominator, The Bourne Shell. Every Shell script specifies the shell it wants to be executed with. Although this can be overridden on the command line. Bash as a version four dot two, has the following features. If then else if conditionals, Case statements, Conditional Tests for, file ownership, file permissions, numeric equivalence, text equivalence, file type is a file, file type is a directory, file type is a block device or character device, file is readable, writable or executable, a file exists or a directory exists. For Loops, C-Style For Loops, While Until Loops with conditions. Brace Expansion, Arithmetic Expansion, Command Substitution, Integer Math, Mathematical Conditionals, Indexed Arrays, Associative Arrays, Extended Globs, and Expanded Regular Expressions. Other features include; functions, substring operations, parameter substitution, increment and decrement operators, debug traps, positional arguments, sub shells, and lastly co-processes. Bash is good for automating tasks, and interacting with the operating system. There are jobs like running multiple processes asynchronously, and waiting for all processes to finish before moving on, that are very simple in Bash, but complex and other languages. There are times when you shouldn't use Bash, for instance, Bash does not handle complex data types like XML or JSON, nor can it handle floating point math internally, and relies on external commands for this. Bash, if written poorly, is difficult to troubleshoot, as it's loosely typed and often runs code, even if it doesn't work. Also, there's no object orientation in Bash.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Introduction to Bash2m 9s
-
(Locked)
What is a shell script?3m 57s
-
(Locked)
Execute compound commands5m 59s
-
(Locked)
Use Command and Variable substitution6m 21s
-
(Locked)
Conditional flow with if, then if3m 12s
-
(Locked)
Conditional flow with case2m 21s
-
(Locked)
Iterate with for loops2m 42s
-
(Locked)
Iterate with while loops1m 30s
-
(Locked)
Using return codes6m 32s
-
(Locked)
Create a monitor script3m
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-