The Shell Or BackDoor
Definition of shell scripts is a set of Unix commands written on a single file which is then executed by the file name. This shell script is also known by the name of the command file (Command File) or shorter again called Skripl. In this paper only discussed pembauatan scripts using the C Shell, Korn Shell and Bourne Shell.
To make this shell script can use any text editor, bleak Vi, Emacs, and Pico. Example 1: echo "Date Now" date
So it is run by calling the program name, eg name of the program example 1, it will display: Now Date: December 16, 1998
When the program is placed on the user's home directory (usually / home / user_name), then how to run the program is by typing "point garismiring. /": $ ./contoh1 (Giving ". /")
While permition setnya be amended as follows: chmod + x example 1, it means that the file into an executable. If permition setnya not changed, it will arise the following message: $. / Try permition denied
Giving suffix (extension) on a script indicate the type of shell used. For example: -. Csh scripts for C shell extension -. Sh extension scripts for the Bourne shell or Korn shell
In some systems, a shell script for C shell, on the first line should be preceded by a "#", while for other than the C shell shell used the sign ":". Example Example 2: # echo "Date Now: \ n" # is the comment section, the \ n so that the results out date # as shown in the next row.
Output: Date Now: December 5, 1998 # note the results with the example 1
Variable The variable is a name that can be used to accommodate a value. Variables can include names, numbers, or underscores (_)
How giving value to vaiabel a. In the Bourne and Korn Shell: variable = value
If the variable contains a particular character is written in a way to give double quotes (") Variable = "Character"
b. In the C shell: @ Variable = value (the @ sign with a space separated variable)
As for the variables that menganduing character by adding the word "set" So: set variable = "character"
Reading data from keybord The command to read the insert from the keybord is: "read" For example: echo-n "Enter your name:" read name echo "Hi $ name, how are you?"
Results of execution: Enter your name: bom2stalker Bom2stalker Hi, how are you?
Argument Processing This argument in the shell, also known as positional parameters. For example: ls-a-l, then: arguments [0] = ls argmunet [1] =-a arguments [2] =-l
Table -1: Parameters related to the parameter position Bourne & Korn Shell C Shell Description $ # $ # Argv Stating the number of parameters $ 0 $ 0 $ Argv [0] Stating the name of a shell script $ 1 $ 1 $ Argv [1] To declare the first parameter .. .. .. $ * $ Argv [*] To declare all the parameters
Especially for the tenth and setersunya parameters need to be expressed by $ {10} (numbers expressed in brackets {}).
Example 3: The script with the Bourne / Korn shell : # Argument.sh # Example of processing an argument with the Bourne Shell and Korn Shell
echo "number of arguments = $" echo "all arguments = $ *" echo "The contents of \ $ 0: $ 0" echo "content of \ $ 1: $ 1"
Example 4: the C shell scripts: # # Argument.sh # Example of processing an argument with the Bourne Shell and Korn Shell
echo "number of arguments = $" echo "all arguments = $ *" echo "The contents of \ $ 0: $ 0" echo "content of \ $ 1: $ 1"
The result of the execution of these two instances (3 and 4) are: $. / Hello argument.sh all parameters = hello The contents of $ 0: argument.sh The contents of $ 1: hello
Both the C shell, Korn shell, or Bourne shell command have conditioned, in the form: - If - Switch (Cshell) - Case (Bourne and Korn Shell)
The command is useful for repeating the process are: - For (Bourne & Korn shell) - Foreach (C shell) - Until (Bourne, Korn, and C shell) - While (Bourne, Korn, and C shell) - Repeat (C shell)
One use of the script is to use the File Profile. Profile file is an executable when a user login. The following is a profile file names for different types of shell:
Table -2 Profile on shell
Table -2 Profile on shell Shell Name Filename Profile Bourne Shell. Profile C Shell. Login Korn Shell. Profile
These files can be used to put the actions perli done at login time. Often this file to use to run the application automatically, so users do login. This is done in user-user who is acting as operator. They do not go to the login prompt. To find an example profile file, you can see the contents of the existing profile file on each user's home directory. We can add commands to that file, because the file is actually a shell script.
More information on each shell can be obtained online by giving the command: - Man csh (C shell To see the manual) - Man sh (Bourne shell To see the manual) - Man ksh (Korn shell to see the manual)

















