Tero Karvinen - Articles - Downloads - Courses - Contact

Table of Contents

Shell Scripting

Shell scripting automates repeating actions. It is reliable, used in server startup scripts in Linux. It is fast to use, simply write the same commands as you do in command line.

This article is a work in progress.

Hello world - lspwd

A sample shell script that runs ‘ls’ and ‘pwd’ one after another.

$ nano lspwd
#!/bin/bash
ls
pwd
$ chmod a+x lspwd
$ ./lspwd
foo   Examples
/home/tero/

See also

aboutusers - “for each” is the most important control structure in shell scripts.

http://tldp.org/LDP/abs/html/ Best bash scripting reference. Don’t run the first example that does something as root.

Per user bin

Last modified: 2007-12-04. Permanent url: http://www.iki.fi/karvinen/shell_scripting.html

Tero Karvinen www.iki.fi/karvinen - Top - Validate HTML - Validate CSS