Saturday, September 13, 2014

Glance at shell scripts

Glance at shell scripts


Consists of a Linux system of several components, the most important of these components is the Linux kernel and is the heart of the system, there are so-called chance (Shell) which is surrounded Kalglaf Linux kernel which is often called the coincidence Bash in all Linux distributions almost coincidence Bash is responsible for the implementation of the orders of the terminal, for example, a responsible for taking orders and passed to the kernel and deal with it, which is very useful and depend on them most of the Linux applications.

When you perform the ls command, for example, which lists all the files and folders on the current track in the terminal, the chance Bash automatically track the implementation of the program in the / bin / ls, then the program is executed and is listed components of the current track.

Crippling Script is a set of serial commands that are written for a particular job, you can perform anything and anything you want to modify the system via shell scripts, Bash the chance to read the orders and instructions of the shell script file and are being implemented to perform the task it was designed for.

Crippling Script Lech requirement that orders be just like normal ls and pwd, can contain conditional sentences if and functions and variables and things very complicated, and differs from the use of these things, each according to target shell scripts.


This is a very simple example for Shell Script file does ask you for your name and your age, then Btabaathma, Take these commands in a file and save it in a folder, for example test.sh home:


#!/bin/bash
echo "Enter your name:"; read name
echo "Enter your age:"; read age
echo "Hello $name, you are $age years old!"




Then applied the following command to give the powers of the implementation of the file first:


chmod 755 test.sh

Now to execute shell scripts, dish follows:

./test.sh

Share this article :

0 comments:

Post a Comment