1. Home
  2. Computing & Technology
  3. Linux

Bash Guide For Beginners

From Authors, for About.com

1.5.4. A word on order and logic

In order to speed up the developing process, the logical order of a program should be thought over in advance. This is your first step when developing a script.

A number of methods can be used; one of the most common is working with lists. Itemizing the list of tasks involved in a program allows you to describe each process. Individual tasks can be referenced by their item number.

Using your own spoken language to pin down the tasks to be executed by your program will help you to create an understandable form of your program. Later, you can replace the everyday language statements with shell language words and constructs.

The example below shows such a logic flow design. It describes the rotation of log files. This example shows a possible repetitive loop, controlled by the number of base log files you want to rotate:

  • Do you want to rotate logs?

    • If yes:

      • Enter directory name containing the logs to be rotated.

      • Enter base name of the log file.

      • Enter number of days logs should be kept.

      • Make settings permanent in user's crontab file.

    • If no, go to step 3.

  • Do you want to rotate another set of logs?

    • If yes: repeat step 1.

    • If no: go to step 3.

  • Exit

The user should provide information for the program to do something. Input from the user must be obtained and stored. The user should be notified that his crontab will change.

* License

* Bash Guide For Beginners Index

Explore Linux
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux Documentation
  5. Bash Guide for Beginners
  6. Bash Guide For Beginners - 1.5.4. A word on order and logic

©2009 About.com, a part of The New York Times Company.

All rights reserved.