Shell Scripting

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


Posted in Old Site | Tagged , , , | 3 Comments

3 Responses to Shell Scripting

  1. Pingback: Aikataulu – Linux palvelimet ict4tn021 4-ti ja 5-to – alkusyksy 2017 – 5 op | Tero Karvinen

  2. To make your script available for all users,

    $ sudo cp lspwd /usr/local/bin/

    Then you can, in any directory

    $ lspwd

  3. Pingback: Linux Palvelimena kotitehtävä 4 | Metapaketti & Reprepro | Esa Eskola & Linux Palvelimena

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Picks

  • Boxing Clock for AndroidOcton8 Diving T-ShirtsShaking Tower Panda Android GameLearn Chinese with Android
  • Student projects