1. Computing

Discuss in my forum

Bash Guide For Beginners

By

2.1.2. script1.sh

In this example we use the echo Bash built-in to inform the user about what is going to happen, before the task that will create the output is executed. It is strongly advised to inform users about what a script is doing, in order to prevent them from becoming nervous because the script is not doing anything . We will return to the subject of notifying users in Chapter 8 .

Figure 2-1. script1.sh

Write this script for yourself as well. It might be a good idea to create a directory ~/scripts to hold your scripts. Add the directory to the contents of the PATH variable:

export PATH ="$PATH :~/scripts "

If you are just getting started with Bash, use a text editor that uses different colours for different shell constructs. Syntax highlighting is supported by vim , gvim , (x)emacs , kwrite and many other editors; check the documentation of your favorite editor.


       Different prompts
        

The prompts throughout this course vary depending on the author's mood. This resembles much more real life situations than the standard educational $ prompt. The only convention we stick to, is that the root prompt ends in a hash mark (#).

* License

* Bash Guide For Beginners Index

  1. About.com
  2. Computing
  3. Linux

©2014 About.com. All rights reserved.