
For this reason, this document only covers the Bourne shell syntax. However, the Bourne shell syntax is significantly more flexible and thus more widely used. The C shell syntax is more comfortable to many C programmers because the syntax is somewhat similar. To that end, the first lesson you must learn before writing a shell script is that there are two fundamentally different sets of shell script syntax: the Bourne shell syntax and the C shell syntax. Because of these differences, the road to good shell scripting can be fraught with peril, leading to script failures, misbehavior, and even outright data loss. There are many different dialects of shell scripts, each with their own quirks, and some with their own syntax entirely. It does, however, provide a good starting point for beginners first learning this black art. This document is not intended to be a complete reference on writing shell scripts, nor could it be. The remaining chapters in this document provide additional breadth and depth. This chapter and the next two chapters introduce the basic concepts of shell scripting. Put another way, it is often easy to write a script, but it can be more challenging to write a script that consistently works well. If you don’t true your scripts, they wobble. If you have ever successfully trued a bicycle wheel (or paid someone else to do so), that’s similar to learning the basics of shell scripting. While shell scripts can be used for more complex tasks, they are usually not the best choice. Shell scripting is generally considered to be a glue language, ideal for creating small pieces of code that connect other tools together. With a bit more experience, you become comfortable riding them around town, but also quickly discover why most people drive cars for longer trips. You fall off and scrape your knees a lot at first. Writing a shell script is like riding a bike.
