From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search

This article is a stub. You can help us by expanding it.

Linux Shell Scripting Tutorial v2.0

Written by Vivek Gite <> and Edited By Various Contributors

Latest Wiki version -

Linux Shell Scripting Tutorial - A Beginner's handbook:About
Chapter 1
Quick Introduction to Linux
What Is Linux
Who created Linux
Where can I download Linux
How do I Install Linux
Linux usage in everyday life
What is Linux Kernel
What is Linux Shell
Unix philosophy
But how do you use the shell
What is a Shell Script or shell scripting
Why shell scripting
Chapter 1 Challenges
Chapter 2
Getting Started With Shell Programming
The bash shell
Shell commands
The role of shells in the Linux environment
Other standard shells
Hello, World! Tutorial
Shell Comments
Setting up permissions on a script
Execute a script
Debug a script
Chapter 2 Challenges
Chapter 3
The Shell Variables and Environment
Variables in shell
Assign values to shell variables
Default shell variables value
Rules for Naming variable name
Display the value of shell variables
The export statement
Unset shell and environment variables
Getting User Input Via Keyboard
Perform arithmetic operations
Create an integer variable
Create the constants variable
Bash variable existence check
Customize the bash shell environments
Recalling command history
Path name expansion
Create and use aliases
The tilde expansion
Startup scripts
Using aliases
Changing bash prompt
Setting shell options
Setting system wide shell options
Chapter 3 Challenges
Chapter 4
Conditionals Execution (Decision Making)
Bash structured language constructs
Test command
if structures to execute code based on a condition
Nested ifs
Multilevel if-then-else
The exit status of a command
Conditional execution
Logical AND &&
Logical OR ||
Logical Not !
Conditional expression using [
Conditional expression using [[
Numeric comparison
String comparison
File attributes comparisons
Shell command line parameters
How to use positional parameters
Parameters Set by the Shell
Create usage messages
Exit command
The case statement
Dealing with case sensitive pattern
Chapter 4 Challenges
Chapter 5
Bash Loops
The for loop statement
Nested for loop statement
The while loop statement
Use of : to set infinite while loop
The until loop statement
The select loop statement
Exit the select loop statement
Using the break statement
Using the continue statement
Command substitution
Chapter 5 Challenges
Chapter 6
Shell Redirection
Input and Output
Standard input
Standard output
Standard error
Empty file creation
/dev/null discards unwanted output
here documents
here strings
Redirection of standard error
Redirection of standard output
Appending redirected output
Redirection of both standard error and output
Writing output to files
Assigns the file descriptor (fd) to file for output
Assigns the file descriptor (fd) to file for input
Closes the file descriptor (fd)
Opening the file descriptors for reading and writing
Reads from the file descriptor (fd)
Executes commands and send output to the file descriptor (fd)
Chapter 6 Challenges
Chapter 7
Pipes and Filters
Linking Commands
Multiple commands
Putting jobs in background
How to use pipes to connect programs
Input redirection in pipes
Output redirection in pipes
Why use pipes
Chapter 7 Challenges
Chapter 8
What is a Process?
How to view Processes
Sending signal to Processes
Terminating Processes
Shell signal values
The trap statement
How to clear trap
Include trap statements in a script
Use the trap statement to catch signals and handle errors
What is a Subshell?
Compound command
exec command
Chapter 8 Challenges
Chapter 9
Writing your first shell function
Displaying functions
Removing functions
Defining functions
Writing functions
Calling functions
Pass arguments into a function
local variable
Returning from a function
Shell functions library
Source command
Recursive function
Putting functions in background
Chapter 9 Challenges
Chapter 10
Interactive Scripts
Menu driven scripts
Getting information about your system
Bash display dialog boxes
dialog customization with configuration file
A yes/no dialog box
An input dialog box
A password box
A menu box
A progress bar (gauge box)
The form dialog for input
Console management
Get the name of the current terminal
Fixing the display with reset
Get screen width and hight with tput
Moving the cursor with tput
Display centered text in the screen in reverse video
Set the keyboard leds
Turn on or off NumLock leds
Turn on or off CapsLock leds
Turn on or off ScrollLock leds

Shell scripting help
Recommended Books