From the course: Cert Prep LPIC-1 Exam 102 (Version 5.0)
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
What is a shell script? - Linux Tutorial
From the course: Cert Prep LPIC-1 Exam 102 (Version 5.0)
What is a shell script?
- [Instructor] The beauty of shell scripting is that we don't need a complex development environment to get started. To make a shell scrip that acts like a system command, we do need to do a few things. First, we create a text file in our favorite text editor. In a terminal, type in VI space tilde slash script.sh. We've named it script.sh so that VI will do syntax highlighting for us. Scripts don't have to be named like this but it makes it nicer for text editors. Syntax highlighting makes debugging easier. Hit enter. For the next step we need to edit the text file and make the first line point to the shell interpreter. We can do this by pointing at it directly to the shell interpreter by using the absolute path. Go into insert mode by pressing the I key, then add hash bang, slash bin, slash bash. In this case we're specifying an absolute path to the bash interpreter executable. We can also use a second form. Hash…
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
-
What is a shell script?3m 57s
-
Execute compound commands5m 59s
-
Use Command and Variable substitution6m 21s
-
Conditional flow with if, then if3m 12s
-
Conditional flow with case2m 21s
-
Iterate with for loops2m 42s
-
Iterate with while loops1m 30s
-
Using return codes6m 32s
-
Create a monitor script3m
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-