How to Build a Simple Script on a Unix or Linux System

Creating a script on a Unix or Linux system can be easy or complex, writes Sandra Henry-Stocker in her Unix as a Second Language column. It all depends on how much you’re trying to get the script to do. In this brief tutorial, Henry-Stocker explains scripting basics and shows how to get started, even if you’ve never written a script before.

One of the first steps is determining which scripting language you want to use. “Bash is one of the most popular, but there’s also zsh, csh, tcsh and korn. There’s even one called fish that can be especially nice for Linux beginners because of its helpful command auto-completion options,” she says.

However, she notes, “one easy choice for scripting is to use whatever shell you use on the command line since, after all, you’ll be more or less comfortable using it.”

“Any command you run on the Linux command line can be run in a script provided it’s compatible with the specified shell,” she says. Henry-Stocker provides clear and easy steps to build a simple script and shares a short example that shows the current date in a day-month-year format.

Read the complete article at NetworkWorld.

Comments