Shell Introduction
The shell is in the outer layer of the kernel, which is responsible for receiving commands entered by the user, then interprets the command as kernel can understand it, then executes it by kernel, and returns the result back to
1. Build and run the shell program
What is a shell program? Simply put, a shell program is one that contains several lines
File for Shell or Linux commands.
As with programs written in high-level languages, writing a shell program requires a text
In the process of database operation, the Shell script provides great convenience for operation and maintenance. A shell script parameter passed as a variable to SQL and a SQL script is one of the scenarios that DBAs often encounter. This article
It took me 10 minutes to figure it out. = "and"-N "usage differences, make a note to smooth
First method: Test if Apache is turned on? String test
#!/bin/bash
web= '/usr/bin/pgrep httpd '
If [-N "$web"]; $web whether the return value is empty
Write a script that can generate random passwords, if you want pure numbers or only letters or case, can be customized, I write a full element here.
#!/bin/bash
# Author:honway.liu #
date:2013-07-19 #
concate:gm100861@gmail.com
len=90
str= (a B C
If you need to get the full path of a selected file, little brother often mechanically copied the path in the shell window, then copied the file name and spelled it after the path. Sometimes the file path is copied for use by the program, which
In the shell script to do a variety of tests frequently, test the format of the statement:
(1) Test
(2) [
(3) [[
Three kinds of differences, in the third can be a wildcard matching, and &&,| |,, the operator can also be normal presence in [[]],
1. "" "" "The Difference," "The variables will be resolved" "All of them as strings" "to execute system commands
2. The custom variable defaults to a local variable, and the environment variable is a global variable.
3.export can set one or more
1.Linux users are divided into ordinary user accounts and Superuser user accounts.
The 2.Linux group accounts are divided into private groups and standard groups. When you create a new user, but do not specify the group to which he belongs,
The IF function in the shell is beyond doubt that every 80% of the shells will be applied to if judgment, then as a novice I should be the whole, I heard a morning class today, and then the morning's things summed up a script, and then to the people
These five positions are also known as five hooks (hook functions), also called Five rule chains.1.PREROUTING (before routing)2.INPUT (packet inflow port)3.FORWARD (forward tube card)4.OUTPUT (Packet egress)5.POSTROUTING (after routing)This is the
Command historySummary: Bash holds a list of commands that have been executed in the past.The command process for the current shell is saved in memory.When you exit, save the hidden folder to the current User folder. Bash_histroy, ls-a can
Transferred from: https://zhidao.baidu.com/question/357781350.html while Read-u3 i && Read-u4 J; Do Echo done34Read-u3 I means to read a row of data in the I variable from FD # 3rd (file descriptor, filename descriptor), so you know what Read-u4 J
Open multiple sub-processes in the script with & background, and use the wait command to make these sub-processes execute in parallel.Example 1:fun1 () {whiletruedoesecho1sleep1done }fun2 () {whiletruedoecho2sleep 1 Done &&WaitExample
Specify bashShell script first line, #! What should it be?Most of the cases/usr/bin/env bash,/bin/bash,/usr/bin/bash,/bin/sh,/usr/bin/env sh are equivalent, but few cases still have pits. If the default shell may not be bash, such as a release law,
1. Iterate over each line in the file while read line; Do Echo $line; Done file. txtOrCat file. txt | ( while read line; Do echo $line; done)OrCat file awk ' {print} '2. Iterate over a word for inch $line; Do Echo $word; Done3. WC statistics
Basic assignment of an array
Arr= (a b C)
Arr[index]=a
2. Two common methods
Str=${arr[@]} (array converted to string)
len=${#arr [*]} (array length)
3. Ways to
Take a look at several common sorting algorithms in the next two days.1. Bubble Sort MethodEach time the adjacent elements are compared from i=0, if arr[i]>arr[i+1], they are exchanged. Until the biggest element is pushed to the end. Go back to i=0
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.