www.shellscript.sh Open in urlscan Pro
66.175.210.189  Public Scan

Submitted URL: http://shellscript.sh/
Effective URL: https://www.shellscript.sh/
Submission: On April 27 via api from GB — Scanned from GB

Form analysis 1 forms found in the DOM

POST /mail/index.php

<form action="/mail/index.php" method="post" class="contact-form" id="contact-form">
  <fieldset class="col-md-4 col-sm-6">
    <input type="text" name="8kfW-Name-pJYZ" id="8kfW-Name-pJYZ" placeholder="Your Name...">
  </fieldset>
  <fieldset class="col-md-4 col-sm-6">
    <input type="email" name="EnVF-email-5n79" id="email" placeholder="Your Email...">
  </fieldset>
  <fieldset class="col-md-4 col-sm-12">
    <input type="text" name="QnN6-Subject-0vY5" id="QnN6-Subject-0vY5" placeholder="Subject...">
  </fieldset>
  <fieldset class="col-md-12 col-sm-12">
    <textarea name="message" id="message" cols="30" rows="6" placeholder="Leave your message..."></textarea>
  </fieldset>
  <fieldset class="col-md-12 col-sm-6">
    <input type="hidden" name="maths_a" value="7"><input type="hidden" name="maths_b" value="5"><input type="hidden" name="maths_c" value="5"><input type="hidden" id="mailkey" name="mailkey" value="1651065876"><input type="text"
      name="4A2x-Maths-iI81" id="4A2x-Maths-iI81" placeholder="Prove you're human: What is 7 + 5 - 5?">
  </fieldset>
  <fieldset class="col-md-12 col-sm-12">
    <input type="submit" class="button big default" value="Send Message">
  </fieldset>
</form>

Text Content

SHELL SCRIPTING TUTORIAL

The Linux Shell Scripting Tutorial

 * NEW: Shell Scripting Tips
   
 * 1. Introduction
 * 2. Philosophy
 * 3. A First Script
 * 4. Variables (Part 1)
 * 5. Wildcards
 * 6. Escape Characters
 * 7. Loops
 * 8. Test
 * 9. Case
 * 10. Variables (Part 2)
 * 11. Variables (Part 3)
 * 12. External Programs
 * 13. Functions
 * 14. Hints and Tips
 * 15. Quick Reference
 * 16. Interactive Shell
 * 17. Exercises

 * Contact Me


SHELL SCRIPTING TUTORIAL

A Bourne Shell Programming / Scripting Tutorial for learning about using the
Unix shell. Learn Linux / Unix shell scripting by example along with the theory.
I'll have you mastering Unix shell scripting in no time.


Buy this tutorial as a PDF for only $5
 * NEW: Shell Scripting Tips
   
 * 1. Introduction
 * 2. Philosophy
 * 3. A First Script
 * 4. Variables (Part 1)
 * 5. Wildcards
 * 6. Escape Characters
 * 7. Loops
 * 8. Test
 * 9. Case
 * 10. Variables (Part 2)
 * 11. Variables (Part 3)
 * 12. External Programs
 * 13. Functions
 * 14. Hints and Tips
 * 15. Quick Reference
 * 16. Interactive Shell
 * 17. Exercises

 * Publications
 * Contact Me




SHELL SCRIPTING TUTORIAL


Buy this Shell Scripting Tutorial as a PDF for only $5




1. INTRODUCTION


PURPOSE OF THIS TUTORIAL

This tutorial is written to help people understand some of the basics of shell
script programming (aka shell scripting), and hopefully to introduce some of the
possibilities of simple but powerful programming available under the Bourne
shell. As such, it has been written as a basis for one-on-one or group tutorials
and exercises, and as a reference for subsequent use.


GETTING THE MOST RECENT VERSION OF THIS TUTORIAL

You are reading Version 4.2, last updated 2nd March 2021.
The most recent version of this tutorial is always available at:
https://www.shellscript.sh. Always check there for the latest copy. (If you are
reading this at some different address, it is probably a copy of the real site,
and therefore may be out of date).


A BRIEF HISTORY OF SH

Steve Bourne wrote the Bourne shell which appeared in the Seventh Edition Bell
Labs Research version of Unix.
Many other shells have been written; this particular tutorial concentrates on
the Bourne and the Bourne Again shells.
Other shells include the Korn Shell (ksh), the C Shell (csh), and variations
such as tcsh.
This tutorial does not cover those shells.


AUDIENCE

This tutorial assumes some prior experience; namely:

 * Use of an interactive Unix/Linux shell
 * Minimal programming knowledge - use of variables, functions, is useful
   background knowledge
 * Understanding of some Unix/Linux commands, and competence in using some of
   the more common ones. (ls, cp, echo, etc)
 * Programmers of ruby, perl, python, C, Pascal, or any programming language
   (even BASIC) who can maybe read shell scripts, but don't feel they understand
   exactly how they work.

You may want to review some of the feedback that this tutorial has received to
see how useful you might find it.


TYPOGRAPHICAL CONVENTIONS USED IN THIS TUTORIAL

Significant words will be written in italics when mentioned for the first time.

Code segments and script output will be displayed as monospaced text.
Command-line entries will be preceded by the Dollar sign ($). If your prompt is
different, enter the command:

PS1="$ " ; export PS1

Then your interactions should match the examples given (such as ./my-script.sh
below).
Script output (such as "Hello World" below) is displayed at the start of the
line.

$ echo '#!/bin/sh' > my-script.sh
$ echo 'echo Hello World' >> my-script.sh
$ chmod 755 my-script.sh
$ ./my-script.sh
Hello World
$


Entire scripts will be shown with a gray background, and include a reference to
the plain text of the script, where available:

--------------------------------------------------------------------------------

my-script.sh

#!/bin/sh
# This is a comment!
echo Hello World	# This is a comment, too!

--------------------------------------------------------------------------------

Note that to make a file executable, you must set the eXecutable bit, and for a
shell script, the Readable bit must also be set:

$ chmod a+rx my-script.sh
$ ./my-script.sh



Next: Philosophy

 

 

--------------------------------------------------------------------------------

BOOKS AND EBOOKS

My Shell Scripting books, available in Paperback and eBook formats.

Buy this tutorial as a PDF for only $5!


Shell Scripting Tutorial is this tutorial, in 88-page Paperback and eBook
formats. Convenient to read on the go, and to keep by your desk as an
ever-present companion.
Shell Scripting: Expert Recipes for Linux, Bash and more is my 564-page book on
Shell Scripting. The first half explains the features of the shell; the second
half has real-world shell scripts, organised by topic, with detailed discussion
of each script.

CONTACT

You can mail me with this form. If you expect a reply, please ensure that the
address you specify is valid. Don't forget to include the simple addition
question at the end of the form, to prove that you are a real person!




YOU CAN BUY THE CONTENT OF THIS SHELL SCRIPTING TUTORIAL AS A PDF!

Loading...

--------------------------------------------------------------------------------

Copyright © 2000 - 2018 Steve Parker

ko-fi.com/unixsteve


ko-fi.com/unixsteve