Difference between revisions of "BASH/C2/Introduction-to-BASH-Shell-Scripting/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 13: Line 13:
 
|-
 
|-
 
| 00:10
 
| 00:10
| About different types of '''Shells'''
+
|* About different types of '''Shells'''
  
 
|-
 
|-
 
| 00:13
 
| 00:13
|To write a '''Bash Shell script''' and
+
|* To write a '''Bash Shell script''' and
  
 
|-
 
|-
 
| 00:16
 
| 00:16
|To execute it.
+
|* To execute it.
  
 
|-  
 
|-  
Line 45: Line 45:
 
|-
 
|-
 
| 00:43
 
| 00:43
| Please note, '''GNU bash''' version '''4''' or above is recommended for practice.
+
| Please note, '''GNU Bash''' version '''4''' or above is recommended for practice.
  
 
|-  
 
|-  
Line 57: Line 57:
 
|-
 
|-
 
| 00:56
 
| 00:56
|* '''Bash Shell''' is a '''Command language interpreter''' that '''executes''' '''commands'''.
+
| '''Bash Shell''' is a '''command language interpreter''' that '''executes''' '''commands'''.
  
 
|-
 
|-
 
| 01:02
 
| 01:02
|* These '''commands''' are read from the standard '''input''' device.  
+
| These '''commands''' are read from the '''standard input''' device.  
  
 
|-
 
|-
 
| 01:07
 
| 01:07
|* The input device can be-  
+
| The input device can be-  
  
 
|-
 
|-
Line 97: Line 97:
 
|-  
 
|-  
 
|01:40
 
|01:40
| You will see the '''output''' printed on the next line as  '''slash bin slash bash'''.
+
| You will see the '''output''' printed on the next line as: '''slash bin slash bash'''.
 
    
 
    
 
|-
 
|-
Line 109: Line 109:
 
|-
 
|-
 
|01:56
 
|01:56
|Let us switch back to our '''slides''' Bourne Shell.
+
|Let us switch back to our '''slides'''. Bourne Shell-
  
 
|-
 
|-
Line 133: Line 133:
 
|-
 
|-
 
| 02:17
 
| 02:17
| It was created by David Korn.
+
|* It was created by David Korn.
  
 
|-
 
|-
 
| 02:20
 
| 02:20
|It has features of both, '''B Shell''' and '''C Shell''' along with some additional features.  
+
|* It has features of both, '''B Shell''' and '''C Shell''' along with some additional features.  
  
 
|-
 
|-
Line 145: Line 145:
 
|-  
 
|-  
 
| 02:30
 
| 02:30
|* The '''Bash Shell '''was developed by '''GNU Project'''
+
|* The '''Bash Shell '''was developed by '''GNU Project'''.
  
 
|-
 
|-
Line 161: Line 161:
 
|-  
 
|-  
 
| 02:41
 
| 02:41
|* It is the default '''Shell '''of '''FreeBSD '''and its descendants.  
+
| It is the default '''Shell '''of '''FreeBSD '''and its descendants.  
  
 
|-
 
|-
Line 185: Line 185:
 
|-  
 
|-  
 
| 03:08
 
| 03:08
|* It tells the '''Shell''' to '''execute''' this''' text file''' instead of typing the '''commands'''.  
+
| It tells the '''Shell''' to '''execute''' this''' text file''' instead of typing the '''commands'''.  
  
 
|-
 
|-
Line 245: Line 245:
 
|-  
 
|-  
 
| 04:09
 
| 04:09
|Now type: '''gedit space hello underscore world dot sh space &'''(ampersand sign).
+
|Now, type: '''gedit space hello underscore world dot sh space &'''(ampersand sign).
  
 
|-
 
|-
 
|04:20
 
|04:20
|'''Gedit''' is the '''text editor'''. 'Hello underscore world dot sh' is the file name and  
+
|'''gedit''' is the '''text editor'''. 'Hello underscore world dot sh' is the file name and  
  
 
|-
 
|-
 
|04:27
 
|04:27
|we use the & (ampersand) to free up the prompt.
+
|we use the & (ampersand) to free up the '''prompt'''.
  
 
|-
 
|-
Line 269: Line 269:
 
|-
 
|-
 
| 04:47
 
| 04:47
| This is the first line of every bash script.
+
| This is the first line of every '''bash script'''.
  
 
|-
 
|-
Line 285: Line 285:
 
|-
 
|-
 
|05:00
 
|05:00
|'''hash space my first Bash script'''
+
|'''hash space My first Bash script'''
  
 
|-
 
|-
Line 293: Line 293:
 
|-
 
|-
 
|05:11
 
|05:11
|And '''comments''' are ignored by the '''Bash '''interpreter.
+
|And '''comments''' are ignored by the '''Bash''' '''interpreter'''.
  
 
|-
 
|-
Line 305: Line 305:
 
|-
 
|-
 
|05:20
 
|05:20
| and type: '''echo''' space within double quotes '''Hello world'''
+
| and type: '''echo''' space within double quotes '''Hello world'''.
  
 
|-
 
|-
 
|05:27
 
|05:27
| press '''Enter'''.
+
| Press '''Enter'''.
  
 
|-
 
|-
 
| 05:28
 
| 05:28
|Type: '''echo space dollar sign SHELL''' (in Capital)
+
|Type: '''echo space dollar-sign SHELL''' (in Capital)
  
 
|-
 
|-
Line 333: Line 333:
 
|-
 
|-
 
|05:50
 
|05:50
|Let us execute. Come back to our '''terminal'''.
+
|Let us '''execute'''. Come back to our '''terminal'''.
  
 
|-
 
|-
Line 377: Line 377:
 
|-
 
|-
 
| 06:43
 
| 06:43
| Let us go back to our '''slide''' and summarize.
+
| Let us go back to our '''slides''' and summarize.
  
 
|-
 
|-
Line 397: Line 397:
 
|-
 
|-
 
|06:52
 
|06:52
|To write  a simple '''Shell script '''and to execute the script.
+
|* To write  a simple '''Shell script '''and to '''execute''' the script.
  
 
|-
 
|-
Line 406: Line 406:
 
|-
 
|-
 
|07:03
 
|07:03
| and''' “***************” ''' (asterisks) on separate lines.
+
| and''' “***************” ''' (asterisks) on separate line.
  
 
|-
 
|-
Line 446: Line 446:
 
|-
 
|-
 
|07:45
 
|07:45
|More information on this Mission is available at the link shown below. http://spoken   tutorial.org\NMEICT-Intro
+
|More information on this mission is available at the link shown below. http://spoken-tutorial.org/NMEICT-Intro
  
 
|-
 
|-
 
|07:51
 
|07:51
|The script has been contributed  by  FOSSEE and Spoken-Tutorial teams, IIT Bombay.
+
|The script has been contributed  by  FOSSEE and Spoken-Tutorial teams.  
  
 
|-
 
|-

Revision as of 11:53, 9 July 2015

Time Narration
00:01 Dear friends, welcome to the Spoken tutorial on Introduction to BASH shell scripting.
00:08 In this tutorial, we will learn:
00:10 * About different types of Shells
00:13 * To write a Bash Shell script and
00:16 * To execute it.
00:18 To follow this tutorial, you should be familiar with Linux Operating System.
00:25 If not, then for relevant Linux tutorials, please visit our website which is as shown.
00:32 For this tutorial, I am using:
00:35 * Ubuntu Linux 12.04 OS and
00:39 GNU Bash version 4.1.10.
00:43 Please note, GNU Bash version 4 or above is recommended for practice.
00:50 Let us start with an introduction.
00:53 We will see what a Bash Shell is.
00:56 Bash Shell is a command language interpreter that executes commands.
01:02 These commands are read from the standard input device.
01:07 The input device can be-
01:09 your keyboard
01:11 or a simple text file.
01:14 Let me show you what is a Bash Shell.
01:16 Open the terminal window by pressing Ctrl+Alt+T keys simultaneously on your keyboard .
01:24 This will open the Gnome terminal.
01:27 To check which type of shell we are using, type: echo space dollar sign SHELL (in capital).
01:38 Press Enter.
01:40 You will see the output printed on the next line as: slash bin slash bash.
01:47 This indicates that we are using the Bash Shell.
01:51 Now, let us know different types of Shells available.
01:56 Let us switch back to our slides. Bourne Shell-
02:00 * This was original UNIX shell written by Stephen Bourne.
02:06 * It lacked interactivity provided by most modern shells today.
02:11 C Shell-
02:12 It provides features lacking in Bourne Shell .
02:16 K Shell-
02:17 * It was created by David Korn.
02:20 * It has features of both, B Shell and C Shell along with some additional features.
02:27 Bash Shell-
02:30 * The Bash Shell was developed by GNU Project.
02:32 * It is based on B Shell language.
02:35 * It has features of C and K Shells.
02:40 TC Shell-
02:41 It is the default Shell of FreeBSD and its descendants.
02:46 Z shell-
02:49 * It is a Shell designed for interactive use.
02:52 * It has many useful features of ksh, bash and tcsh.
02:58 Now let us see what a Bash Shell script is.
03:02 The Bash Shell script contains a series of Bash commands in plain text file.
03:08 It tells the Shell to execute this text file instead of typing the commands.
03:15 Let us see how to write a simple Bash script.
03:20 We will test the echo command which will print Hello World on the terminal.
03:25 Go back to the terminal.
03:29 Now, type: echo space within double quotes Hello world
03:35 and press Enter.
03:37 This prints Hello World on the terminal.
03:40 The command worked as expected.
03:43 Now, what if we want to use this command in a file?
03:47 Just put this command in a file and execute that file.
03:52 I will use gedit text-editor for this purpose.
03:57 You are free to use your favorite text-editor.
04:00 I want to create my file on the Desktop.
04:03 So, type: cd space Desktop
04:07 Press Enter.
04:09 Now, type: gedit space hello underscore world dot sh space &(ampersand sign).
04:20 gedit is the text editor. 'Hello underscore world dot sh' is the file name and
04:27 we use the & (ampersand) to free up the prompt.
04:32 Now press Enter.
04:33 We have opened a new file named hello_world.sh using gedit.
04:40 Now, type: hash exclamation mark front slash bin front slash bash
04:47 This is the first line of every bash script.
04:51 It is called as shebang or bang line.
04:55 Press Enter.
04:57 Now, let's add a comment to the file by typing:
05:00 hash space My first Bash script
05:06 Remember that any line after hash is treated as a comment.
05:11 And comments are ignored by the Bash interpreter.
05:15 Now we can add the command which we used earlier.
05:19 Press Enter
05:20 and type: echo space within double quotes Hello world.
05:27 Press Enter.
05:28 Type: echo space dollar-sign SHELL (in Capital)
05:34 press Enter.
05:35 Type: echo space backtick date backtick
05:41 backtick symbol is present on the key which has tilde character.
05:47 Now, click on Save to save the file.
05:50 Let us execute. Come back to our terminal.
05:55 First, we have to make the file executable.
05:58 For this, type: chmod space plus x space hello underscore world dot sh
06:09 and press Enter.
06:12 Now, type:
06:14 dot slash hello underscore world dot sh
06:19 Press Enter.
06:22 You can see Hello World is displayed on the terminal.
06:27 The shell type is displayed on the next line. i.e slash bin slash bash
06:32 and day, month, time, time zone and year are displayed.
06:38 The output may vary depending on the system.
06:43 Let us go back to our slides and summarize.
06:46 In this tutorial, we have learnt about:
06:48 * Different types of Shells
06:50 * Bash Shell
06:51 *Bash Shell script.
06:52 * To write a simple Shell script and to execute the script.
06:57 As an assignment- write a simple script to display the message -

Welcome to Bash learning

07:03 and “***************” (asterisks) on separate line.
07:06 Watch the video available at the link shown below.
07:10 It summarizes the Spoken-Tutorial project.
07:13 If you do not have good bandwidth, you can download and watch it.
07:17 The Spoken-Tutorial Project team:
07:20 Conducts workshops using spoken tutorials.
07:22 Gives certificates to those who pass an online test.
07:26 For more details, please write to contact@spoken-tutorial.org
07:34 Spoken Tutorial Project is a part of the "Talk to a Teacher" project.
07:39 It is supported by the National Mission on Education through ICT, MHRD, Government of India.
07:45 More information on this mission is available at the link shown below. http://spoken-tutorial.org/NMEICT-Intro
07:51 The script has been contributed by FOSSEE and Spoken-Tutorial teams.
07:56 This is Ashwini Patil from IIT Bombay, signing off. Thank you for joining.

Contributors and Content Editors

PoojaMoolya, Pratik kamble, Sandhya.np14