The shell provides an interface to UNIX systems. Collects input and executes the program according to input. When a program finishes executing, it displays the output of the program.
The shell is an environment where we can run our commands, programs, and shell scripts. The shell has a different style, just like a different style of operating system. The style of each shell has its own set of recognized commands and functions.
Shell it interprets and executes user-entered commands interactively or automatically interprets and executes predetermined series of commands; As a programming language, it defines variables and parameters, and provides many control structures that are available in high-level languages, including loops and branches.
Several websites that learn shell programming are recommended:
Ubuntu Community: http://wiki.ubuntu.org.cn/Shell%E7%BC%96%E7%A8%8B%E5%9F%BA%E7%A1%80
Easy Hundred Tutorials http://www.yiibai.com/shell/
Chinaunix:http://bbs.chinaunix.net/forum-24-1.html
The shell provides you with an interface to UNIX systems. Collect input from you and execute the program according to the input. When a program finishes executing, it displays the output of the program.
The shell is an environment where we can run our commands, programs, and shell scripts. The shell has a different style, just like a different style of operating system. The style of each shell has its own set of recognized commands and functions. Shell prompt:
Prompt this is called a command prompt $, emitting shell. Although prompts are displayed, you can type a command.
The shell reads the input and presses the ENTER key. It determines the desired command and the first character to perform the input. A word is a complete set of characters. Spaces and tabs separate the words.
Here is a simple example of a date command that displays the current date and time:
$date
Thu June 08:30:19 MST 2009
You can customize your command prompt to use environment variables PS1 environment tutorials to explain. Shell Type:
There are two main types of shells under UNIX systems:
1. Bourne Shell. If you are using a shell of type Bourne, the default prompt is $ character.
2. C Shell. If you are using a C-type shell, the default prompt character%.
There are also a variety of Bourne shell subcategories listed below:
· Bourne Shell (SH)
· Korn Shell (Ksh)
· Bourne Again Shell (bash)
· POSIX Shell (SH)
The different C-type shells are as follows:
· C Shell (CSH)
· Tenex/tops C Shell (tcsh)
The original Unix shell was written in the mid 1970s by Stephen Burn, a lab in AT&T, New Jersey.
The Bourne shell is the first shell to appear on a UNIX system, so it is called the "shell."
The Bourne shell is typically installed as/bin/sh in most UNIX versions. For this reason, it is scripting to use in several different versions of the Unix shell.
In this tutorial, we will cover most of the borne shell concepts based on propagation. Shell script:
The basic concept of a shell script is the sequential execution listed in a list of commands. # is a pound sign in front of the shell script annotation.
Conditional tests, such as value a greater than B value, loop we go through a lot of data, read and store data on the files and variables that read and store the data that the script might contain.
Shell scripts and functions are explained. This means that they will not be compiled.
We'll write a lot of scripts in the next few tutorials. This will be a simple text file in which we will put all our commands and some other necessary structures to tell the shell environment what to do and when to do it. Sample script:
Let's say we created a test.sh script. Note: All scripts. sh extensions. Add anything to the script and need to remind the system to start a shell script. For example:
#!/bin/sh
This is the command that tells the system Bourne Shell to execute the following. This is called home shebang, because the "#" symbol is called a hash, and. Symbols are called bang.
To create a script that contains these commands, put the shebang line first, and then add the command:
#!/bin/bash
Pwd
Ls
Shell Annotations:
You can put the comments in your script as follows:
#!/bin/bash
# Author:zara Ali
# Copyright (c) tutorialsyiibai.com
# Script follows here:
Pwd
Ls
Now save the contents above so that the script can be executed as follows:
$chmod +x test.sh
Now, your shell script can be executed at any time as follows:
$./test.sh
This would producefollowing result:
/home/amrood
test.sh unix-communication.htm unix-environment.htm
Note: To execute any program in the current directory, execute the use of the./program_name Extended shell script:
The shell script has several necessary structures to tell the shell environment what to do and when to do it. Of course, most scripts are more complex than the above.
Shell after all, the real programming language, complete variables, control structures, and so on. No matter how complex the script becomes, it is still a list of commands executed sequentially.
The following script uses a read command to enter from the keyboard and assigns it to the value of the variable person, which is eventually printed in stdout.
#!/bin/sh
# Author:zara Ali
# Copyright (c) tutorialsyiibai.com
# Script follows here:
echo "What is your name?"
Read person
echo "Hello, $PERSON"
The following is an example of a running script:
$./test.sh
What is your name?
Zara Ali
Hello, Zara Ali
$
from:http://www.yiibai.com/shell/what_is_shell.html#