Basic Linux Shell Scripting Concepts

|
Rather Have Fast and Secure Remote
Control?
|
Select Statements
This is used to present the use with a simple menu of choices. Consider the following example.
#!/bin/sh
echo "What is your favourite OS?"
select var in "Linux” “Gnu Hurd” “Free BSD” “Other”; do
break
done
echo “You have selected $var”
For Loops
These loops are used when you have a list of values you want to test. Consider the following example.
#!/bin/bash
for myvar in a b c; do
echo $myvar
done
Quoting
Finally we will cover the idea of quoting. This can be confusing when you first deal with it. Quoting takes the value that is contained within the quotes and treats it as a literal value. For example, ‘$var’ will print $var, as opposed to the value of $var. Both single and double quotes can be used to represent literals, with the difference being that a single quote is an absolute literal, while a double quote will display the value of a variable, if it is inside the quote.
That should be enough to get you started. The next article in this series will further address scripting by taking a look and some commands that are commonly used in scripts such as GREP, as well as the concept of input and output redirection. Finally, my third article will tie things together to create usable administrative scripts.
Written by Corey Hynes - Visit WebsiteNext post in Linux:
Basic Linux Shell Scripting Part 2
Next post in Programming:
Basic Linux Shell Scripting Part 2
Previous post in Linux:
Configuring a Linux Newsgroup (NNTP) Server
Previous post in Programming:
SQL and T-SQL
All Tutorials by Category:
- CCDA Study Guide
- CCNA Study Guide Chapter 01
- CCNA Study Guide Chapter 02
- CCNA Study Guide Chapter 03
- CCNA Study Guide Chapter 04
- CCNA Study Guide Chapter 05
- CCNA Study Guide Chapter 06
- CCNA Study Guide Chapter 07
- CCNA Study Guide Chapter 08
- CCNA Study Guide Chapter 09
- CCNA Study Guide Chapter 10
- CCNA Study Guide Chapter 11
- CCNA Study Guide Chapter 12
- Cognos
- Computer Hardware
A
C
D
E
F
G
H
I
L
M
N
Entire site Copyright © 1999-2007 2000Trainers.com, all rights reserved.
Content on this site may not be copied or reproduced in any way without permission.


