Preface

This document is part of the LiveSupport project, Copyright © 2004 Media Development Loan Fund, under the GNU GPL.

Scope

This document describes the shell script file conventions for the LiveSupport project. See also the generic description of the file conventions in the LiveSupport project.

Introduction

Shell scripts are text-based executable shell command files. As text based files, they should adhere to the generic text-based conventions.

Naming

Shell script files are named by the following rules:
For example, a file with a single-word name may be named like: single.sh, whereas a file with multiple word name would be like: multipleWordNameFile.sh.

Structure

Shell script files are partitioned by using the following 80 column wide partitioning comment:
#-------------------------------------------------------------------------------
# This is the title of the partition
#-------------------------------------------------------------------------------
The file has the following mandatory structure:

Reference to the shell

This is the mandatory reference to the shell executable each script has to begin with:
#!/bin/sh

Header

The header holds all information mandated by the generic guidelines, but starting with the shell comment character #. Note the 80 column wide partitioning delimiter enclosing the header.
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LiveSupport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: maroy $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/doc/developmentEnvironment/shellScriptConventions.html,v $
#-------------------------------------------------------------------------------

Additional sections

Additional sections contain the executing code of the script. Bigger parts of the script may be partitioned by the partitioning commend seen above.

Template

See a generic template for shell scripts. You may freely copy this template when starting to create a new document.