There are several commands on the Linux system for file search, such as: Locate,wheris and find are more commonly used in work.1.locate command: Locate the lookup file is based on the/var/lib/mlocate database, which contains all the local file
Shell Introduction
The shell is a command interpreter that provides interaction between the user and the machine
Support for specific grammars, such as logical judgments, loops
Each user can have their own specific shell
CentOS7
1. When type cycle and until type cycleWhile using a few, the general daemon program or always loop execution will be used, the other loop operations are used for instead.1.1 Type and until type loop syntax(1) While conditional
1. TopicsThere are log 1.log, part of the following:112.111.12.248 - [25/Sep/2013:16:08:31 +0800]formula-x.haotui.com "/seccode.php?update=0.5593110133088248" 200"http://formula-x.haotui.com/registerbbs.php" "Mozilla/4.0 (compatible; MSIE 6.0;
1.shell script gets the native IP address:localhostip= ' lc_all=c ifconfig 'inet addr:'127.0.0.1' | '{print $}'"$localhostIP"2. Automate the setup of an IPSec test environment:#!/bin/Bash#sudo Suecho"Get root! "apt-get Install Strongswan-
There are two ways to send a shell script:Way 1:sh file.sh arg1 Arg 2 ....Mode 2:read-p "hint" Arg 1 arg2The default parameters are directly separated by a space, following a few examples to explain the problems encountered in the communication and
If one, if base 1, single branch 1.1 syntaxif语句语法 单分支结构语法: if [条件]; then 指令 fi 或 if [条件] then 指令 fi1.2 Examples[[email protected] day4]# cat if-single1.sh #!/bin/sh#功能:单分支if结构整数比较,用-lt格式例子#created by
1.1 The following table is a common two-dimensional comparison operatorWe can also see through the man testTips(1) The ".(2) the ">" symbol is greater than the meaning, if[["$a" > "$b"]], if[["$a" \> "$b"]. You need to escape in parentheses because
Break:Berak statements are usually used in loop statements and switch statements, and when the break statement is used in a do-while, for, and while Loop statement, the program terminates the statement following the loop. Usually the break
1. Requirements
Reed is a system administrator who needs to add a teacher and several student users to a server in a classroom, manually adding too much trouble, and ask you to write a bash script for him userctr.sh implement bulk add and
View the default shell types supported in Linux:/etc/shellsEcho Output command-e support for character conversions with backslash controlControl character (requires quotation marks)
\\
Output \ Itself
\a
Exercise 1:Delete the letters in the textRequirements: Delete the line containing the letters in the first 5 lines of a text document and delete all the letters from 6 to 10 lines (file 1.txt, lines greater than 10 lines)Reference Answer:#!/bin/bash#
20.5 logical judgments in shell scripts
If judgment
#if If the 1:if condition of the Chinese language; fi[[email protected] ~]# a=5;if [$a-gt 3];then echo OK; fiok; The reference text format is as follows: # !/bin/basha=5if [$a-gt 3]
Because shell scripts are a collection of many commands, these commands may involve manipulating a file, and the execution of the shell script requires the current user to have permission to run the script, otherwise it will fail because of
1.shell condition judgmentCommand: Test or [Use "[" to End With "]" and a space between judgment statementssuch as: Determine if the demo.c file existsIf [-F DEMO.C]Then...FiOrIf Test–f demo.cThen...Fi1.1 String Comparisonsstring1 = string2 Same as
1.shell command interpreter or shell auto-ops language2. How to execute a shell script(1) Execute permission must be given./first.sh(2) SH first.sh(3) Source first3. More complete Script compositionScript DeclarationComment InformationExecutable
Concepts and Variables I. Understanding shell scriptsThe shell is a command interpreter that executes the commands and programs that the user enters in order (the command that encounters the sub-script, which executes the sub-script first) .The
20.16/20.17 functions in the shellImplicit functions for displaying variablesResults of executionparameter is only one 1, the result of the first is 1, the second is empty, the third is empty, the name of the limb is fun1.sh, a total of 1
Shell script login template description, shell script Template
Write notepad and change the file suffix to sh
#! /Usr/bin/CT
# Log on to ssh
# Use the ssh server spawn in combination with Alibaba CT and send
Spawn ssh root @ ip
# Expectation
Reset
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service