Welcome to our shell scripting tutorial series! It's required that you have a basic knowledge of the Linux Command Line, so be sure to review it before you proceed.
A shell script is a file containing lines of code for the shell to execute. The shell reads each line as if you typed them in one at a time into the terminal.
Scripting languages are interpreted, meaning that they aren't compiled into machine language. This results in less efficiency, but in exchange, we are able to more easily write our scripts.
The scripts may be written in any text editor, so simply select one with syntax highlighting - you may use Vim within your terminal, or something like Sublime Text.
We recommend that you learn a text editor while learning shell scripting. Additionally, if you want to try out Vim, head on over to our in-browser Vim tutorial series, or type
vimtutor into the command line. Taking the time to learn Vim keys will speed up your workflow immensely.
Remember that shell scripts should be short and used to manipuate files and commands. If you find that you're writing something that looks overly complex, and involves a slew of string or arithmetic operations, look into a better-suited scripting language such as Python or Perl.
For this module, we'll be using both the command line and shell scripts to give examples of what we're learning.
Anything that comes after a
$ is considered a command to be typed out on the command line. Anything following a
> symbol is a continuation of the line before.
Comment and explanation lines preceed with a
$ cd ~ # Change to home directory $ echo "Anything proceeding a > \ > symbol means it's a continuation \ > of the line before." Anything proceeding a > symbol means it's a continuation of the line before.
Lastly, anything without a preceding special character will be a snippet from a shell script file.
echo 'This is a snippet from a shell script'
Great start! Now let's move on to some important symbols covered in shell scripting.
Linux for Beginners doesn't make any assumptions about your background or knowledge of Linux. You need no prior knowledge to benefit from this book. You will be guided step by step using a logical and systematic approach. As new concepts, commands, or jargon are encountered they are explained in plain language, making it easy for anyone to understand.$ Check price
Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.$ Check price