Shell Programming BasicsThe shell is a program written in C that is a bridge for users to use Linux. The shell is both a command language and a programming language. A Shell is an application that provides an interface through which users access the
1 What shell?Shell is a scripting languageYou can use logical judgments, loops, and other syntaxFunctions can be custom-definedThe shell is a collection of system commandsShell scripts enable automated operations, which can greatly increase our
The shell has a shell meaning, which provides the platform for the user to interact with the kernel, and the kernel then implements the functionality through the underlying system call. Features of the Linux shell:1. Shortcut: Ctrl + A (ahead) move
Prerequisite: Configure your own machine ssh password-free login#!/bin/bashCat list1234EODWhile Read lineDoif SSH [email protected] "test-f/tmp/a.sh"; Then #配置了免密登录, no password is entered hereecho "$line file exist."Elseecho "$line file not exist."
SHELL:An interface program that completes the interactive operation between the user and the operating system, providing the user with simplified operation;In the middle of the 70 's, Bell Lab, Bourne;bourne Shell, abbreviated Sh;bill JOY:C Shell,
First, we know that there are several ways we execute the shell.1. Sh/bash uses its built-in command set to execute some commands, such as the followingSH Demo.shbash demo.sh2. Use./or $SHELLPATH/*.sh the way to
Sed tool "streaming editor"--Non-interactive, filter based on pattern matching and modify text--progressive processing and output of the results to the screen--can achieve the output of the text, delete, replace, copy, cut, import, export and other
file Expression-e filename true if filename exists-d filename If filename is a directory, true-F filename True if filename is a regular file-L filename True if filename is a symbolic link-r filename If filename is readable, true-W filename if
In addition to being an interpreter, the shell is a high-level programming language with variables, keywords, and a variety of control statements.Command historyHistory displays a list of historical commands, including its ownHistory 50 shows the
Looping statementsThe looping statements in the shell are as follows:
for
while
unitl
case
select
For/while/unitl must end with done
forCycleforLoops are used to iterate through an array (data list) or
Exception handlingYou can use the Try/except statement to catch an exception.The try/except statement is used to detect errors in a try statement block, allowing the except statement to catch exception information and handle it.If you do not want to
first, the contents of the experiment1. Practice command history, aliases, and special character usages in the shell (4th. 4.2, Section ~4.5)2. Shell command application exercise (see Experimental steps)3. Write a shell script that executes in 4
Requirements: Use the shell to customize a variety of personalized alarm tools, but the need for unified management, standardized management.Idea: Specify a script package that contains the main program, subroutine, configuration file, mail engine,
One, Shell command application exercises1. Describe the purpose of the following documents①/etc/passwdpasswd is a password file that is used to manage the user's password. Ordinary users can usually only modify their own password
Op-ExpressionsThe expression is contained in or (()) or [] within,
An arithmetic expression:(())
((expression))
This expression is calculated according to the rules of arithmetic calculation. Equivalent to let expression .
Array: A variable that stores a set of data and is able to manipulate one of the data in this set of data individually.Types of arrays: one-dimensional arrays, two-dimensional arrays, multidimensional arraysTypes of variablesThe default value of an
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.