old-www/HOWTO/Bash-Prog-Intro-HOWTO.html

148 lines
6.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>BASH Programming - Introduction HOW-TO</TITLE>
<LINK HREF="Bash-Prog-Intro-HOWTO-1.html" REL=next>
</HEAD>
<BODY>
<A HREF="Bash-Prog-Intro-HOWTO-1.html">Next</A>
Previous
Contents
<HR>
<H1>BASH Programming - Introduction HOW-TO</H1>
<H2>by Mike G <CODE>mikkey at dynamo.com.ar</CODE></H2> Thu Jul 27 09:36:18 ART 2000
<P><HR>
<EM> This article intends to help you to start programming basic-intermediate shell scripts. It does not intend to be an advanced document (see the title). I am NOT an expert nor guru shell programmer. I decided to write this because I'll learn a lot and it might be useful to other people. Any feedback will be apreciated, specially in the patch form :) </EM>
<HR>
<P>
<H2><A NAME="toc1">1.</A> <A HREF="Bash-Prog-Intro-HOWTO-1.html">Introduction</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-1.html#ss1.1">1.1 Getting the latest version</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-1.html#ss1.2">1.2 Requisites</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-1.html#ss1.3">1.3 Uses of this document</A>
</UL>
<P>
<H2><A NAME="toc2">2.</A> <A HREF="Bash-Prog-Intro-HOWTO-2.html">Very simple Scripts</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-2.html#ss2.1">2.1 Traditional hello world script</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-2.html#ss2.2">2.2 A very simple backup script</A>
</UL>
<P>
<H2><A NAME="toc3">3.</A> <A HREF="Bash-Prog-Intro-HOWTO-3.html">All about redirection</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-3.html#ss3.1">3.1 Theory and quick reference</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-3.html#ss3.2">3.2 Sample: stdout 2 file </A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-3.html#ss3.3">3.3 Sample: stderr 2 file </A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-3.html#ss3.4">3.4 Sample: stdout 2 stderr</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-3.html#ss3.5">3.5 Sample: stderr 2 stdout </A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-3.html#ss3.6">3.6 Sample: stderr and stdout 2 file </A>
</UL>
<P>
<H2><A NAME="toc4">4.</A> <A HREF="Bash-Prog-Intro-HOWTO-4.html">Pipes</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-4.html#ss4.1">4.1 What they are and why you'll want to use them</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-4.html#ss4.2">4.2 Sample: simple pipe with sed </A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-4.html#ss4.3">4.3 Sample: an alternative to ls -l *.txt </A>
</UL>
<P>
<H2><A NAME="toc5">5.</A> <A HREF="Bash-Prog-Intro-HOWTO-5.html">Variables</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-5.html#ss5.1">5.1 Sample: Hello World! using variables</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-5.html#ss5.2">5.2 Sample: A very simple backup script (little bit better)</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-5.html#ss5.3">5.3 Local variables</A>
</UL>
<P>
<H2><A NAME="toc6">6.</A> <A HREF="Bash-Prog-Intro-HOWTO-6.html">Conditionals</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-6.html#ss6.1">6.1 Dry Theory</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-6.html#ss6.2">6.2 Sample: Basic conditional example if .. then</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-6.html#ss6.3">6.3 Sample: Basic conditional example if .. then ... else</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-6.html#ss6.4">6.4 Sample: Conditionals with variables</A>
</UL>
<P>
<H2><A NAME="toc7">7.</A> <A HREF="Bash-Prog-Intro-HOWTO-7.html">Loops for, while and until</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-7.html#ss7.1">7.1 For sample</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-7.html#ss7.2">7.2 C-like for</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-7.html#ss7.3">7.3 While sample</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-7.html#ss7.4">7.4 Until sample</A>
</UL>
<P>
<H2><A NAME="toc8">8.</A> <A HREF="Bash-Prog-Intro-HOWTO-8.html">Functions</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-8.html#ss8.1">8.1 Functions sample</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-8.html#ss8.2">8.2 Functions with parameters sample</A>
</UL>
<P>
<H2><A NAME="toc9">9.</A> <A HREF="Bash-Prog-Intro-HOWTO-9.html">User interfaces</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-9.html#ss9.1">9.1 Using select to make simple menus</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-9.html#ss9.2">9.2 Using the command line </A>
</UL>
<P>
<H2><A NAME="toc10">10.</A> <A HREF="Bash-Prog-Intro-HOWTO-10.html">Misc</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-10.html#ss10.1">10.1 Reading user input with read</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-10.html#ss10.2">10.2 Arithmetic evaluation</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-10.html#ss10.3">10.3 Finding bash </A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-10.html#ss10.4">10.4 Getting the return value of a program</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-10.html#ss10.5">10.5 Capturing a commands output </A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-10.html#ss10.6">10.6 Multiple source files</A>
</UL>
<P>
<H2><A NAME="toc11">11.</A> <A HREF="Bash-Prog-Intro-HOWTO-11.html">Tables</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-11.html#ss11.1">11.1 String comparison operators</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-11.html#ss11.2">11.2 String comparison examples</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-11.html#ss11.3">11.3 Arithmetic operators</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-11.html#ss11.4">11.4 Arithmetic relational operators</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-11.html#ss11.5">11.5 Useful commands</A>
</UL>
<P>
<H2><A NAME="toc12">12.</A> <A HREF="Bash-Prog-Intro-HOWTO-12.html">More Scripts</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-12.html#ss12.1">12.1 Applying a command to all files in a directory. </A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-12.html#ss12.2">12.2 Sample: A very simple backup script (little bit better)</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-12.html#ss12.3">12.3 File re-namer</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-12.html#ss12.4">12.4 File renamer (simple)</A>
</UL>
<P>
<H2><A NAME="toc13">13.</A> <A HREF="Bash-Prog-Intro-HOWTO-13.html">When something goes wrong (debugging)</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-13.html#ss13.1">13.1 Ways Calling BASH </A>
</UL>
<P>
<H2><A NAME="toc14">14.</A> <A HREF="Bash-Prog-Intro-HOWTO-14.html">About the document</A></H2>
<UL>
<LI><A HREF="Bash-Prog-Intro-HOWTO-14.html#ss14.1">14.1 (no) warranty</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-14.html#ss14.2">14.2 Translations</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-14.html#ss14.3">14.3 Thanks to</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-14.html#ss14.4">14.4 History</A>
<LI><A HREF="Bash-Prog-Intro-HOWTO-14.html#ss14.5">14.5 More resources</A>
</UL>
<HR>
<A HREF="Bash-Prog-Intro-HOWTO-1.html">Next</A>
Previous
Contents
</BODY>
</HTML>