Difference between revisions of "BASH"
(→BASH Shell Scripting) |
(→BASH Shell Scripting) |
||
Line 36: | Line 36: | ||
#*The export statement | #*The export statement | ||
# Array Operations in BASH | # Array Operations in BASH | ||
− | #*Declaring an Array and Assigning values | + | #*Declaring an Array and Assigning values |
#*Initializing an Array during declaration | #*Initializing an Array during declaration | ||
#*To find length of Bash Array and length of nth element | #*To find length of Bash Array and length of nth element | ||
Line 52: | Line 52: | ||
# More on If loops | # More on If loops | ||
#*Nested if | #*Nested if | ||
+ | #*Nested if- Flowgraph | ||
#*Nested If-else with Name and Password verification program | #*Nested If-else with Name and Password verification program | ||
#*Multilevel if-then-else | #*Multilevel if-then-else | ||
+ | #*Multilevel if-then-else- Flowgraph | ||
#*Multilevel if-else with String comparison program | #*Multilevel if-else with String comparison program | ||
# Logical Operations | # Logical Operations |
Revision as of 10:32, 13 August 2013
Bash is the shell, or command language interpreter, that will appear in the GNU operating system. Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). It offers functional improvements over sh for both programming and interactive use. In addition, most sh scripts can be run by Bash without modification. The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic. In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files,directories,processes etc. These tutorials are created using Ubuntu version 12.04 and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable.
The Spoken Tutorial Effort for Bash is being contributed by Ms. Ashwini Patil, Ms. Lavitha Monisha Pereira and Mr. Sachin Patil from IIT Bombay.
Linux Slide Template (TEX Format) Glossary
(PPT Format)
(ODP Format)
Contents
BASH Shell Scripting
- Introduction to BASH Shell Scripting
- The bash shell
- Bash Shell Script
- Basics of Shell Scripting
- System variables
- User defined variables
- Accepting user input via keyboard
- Command Line arguments and quoting
- Command Line arguments
- Single quote
- Double quote
- Backslash
- Globbing and export statements
- Globbing
- The export statement
- Array Operations in BASH
- Declaring an Array and Assigning values
- Initializing an Array during declaration
- To find length of Bash Array and length of nth element
- To print whole Bash Array
- More on Arrays
- Extraction of Array elements
- Search and replace in an Array element
- To Add an element to an Array
- To remove an Element from an Array
- Conditional execution
- Test
- Syntax of test
- if...then
- if...then...else...if
- More on If loops
- Nested if
- Nested if- Flowgraph
- Nested If-else with Name and Password verification program
- Multilevel if-then-else
- Multilevel if-then-else- Flowgraph
- Multilevel if-else with String comparison program
- Logical Operations
- logical AND
- logical OR
- logical NOT
- Bash comparison- Arithmetic comparison
- Arithmetic comparison
- Bash comparison- String & File attributes
- String comparison
- File attributes comparisons
- Loops
- The for loop statement
- The while loop statement
- More on Loops
- 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
- The case statement
- using case
- creating menus using case
- multiple options in case
- Functions
- 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
- Source command
- Recursive function
- Putting functions in background
- Redirections (error handling)
- Input and Output
- Standard input
- Standard output
- Standard error
- Redirection of both standard error and output
- Appending redirected output
- Empty file creation
- Here documents
- Here strings
- Assigns the file descriptor (fd) to file for output
- Assigns the file descriptor (fd) to file for input
- Closes the file descriptor (fd)
- Pipes and filters
- Linking Commands
- Multiple commands
- Putting jobs in background
- Pipes
- How to use pipes to connect programs
- Input redirection in pipes
- Output redirection in pipes
- Why use pipes
- Filters
- Signals, process and traps
- Signals
- 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
- Making you shell script interactive (using dialog box)
- Menu driven scripts
- Getting information about your system
- Bash display dialog boxes
- Dialog customisation 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