When operating on SECURECRT, do the following carelessly:?????????????????? [[email protected] ~]# echo "Alias rm= ' echo this command does '" ">. Bash_profile?????????????????? [[Email protected] ~] #source. bash_profile?????????????? When the
1. ExercisesFor a file, 1 to 5 lines delete the line with English, 6 to 10 lines delete the English characters inside;2. AnalysisThis requirement, with the SED command can be solved, mainly used to match the knowledge of replacement.3. Scripts#!/bin/
Shell's unfolding 2018-5-30? writen by Stephen.yu
First, path name expansionBefore the shell executes the echo command, it automatically expands any qualifying characters on the command line, for example, * is expanded to the current path
1. (1) Change the main prompt to the user's home directory name (hint: reference material 4.6.8 section environment variable PS1 and HOME usage)(2) Assign the string DOS file c:>\ $student \* to the variable x and display it (hint: note the choice
In shell programming, it is often necessary to determine the status of a file, whether the string is equal, and two numeric values, and then perform the related operations based on these comparisons. This paper mainly describes the file status,
File header#!/bin/shBasic syntax:Define variables:Your_name= "Aivy"In addition to explicitly assigning values directly, you can also assign a value to a variable using a statement: for file in ' ls/etc ' or for file in $ (LS/ETC)The above statement
1. VariablesA: Define variable a=1, only valid for your shell processB: Define the variable export b=1, which will take effect on your shell process and its child processesC: Variables defined in the script.sh script, when source script.sh is in the
1#! /bin/Bash2 Test () {3echo "not quoted, same as"4Echo $*5echo [email protected]6echo "Add quotation mark and contrast"7 forN in "$*"8 Do9 Echo $NTen Done One Aecho "----------" - forN in "[email protected]" -
is a powerful text search tool that can use regular expressions to search for text and print matching lines.I often use it to find strings such as: grep -rn "字符串" .Recursively finds the "string" in all files in the current directory and the line
The For loop syntax is structured as follows [[email protected] tmp]# cat 1 . sh # !/bin/bash for i in ' Seq 3 " do echo $i done [[email protected] tmp]# sh 1 . sh 1 2 3 Bulk Modify file name [email protected] tmp]# ll
You can convert text results to neat tables, upper and lower commands: ColumnParameters to use:-T: Table with a space interval by default-S: Required with-t use, specify delimiter?Monitor Ogg named field alignment
[[Email protected]
First, if else1.1, ifIf statement syntax format:if condition Then command1 command2 ... fiWrite a line (for the terminal command prompt):if [$ (PSgrep"ssh"1thenecho" True"fiAt the end of the fi is if the upside-down spelling, and later
I. OverviewYou can pass parameters to the script when you execute the Shell script, and the format of the parameters obtained in the script is:$n. n represents a number, 1 is the first argument to execute the script, 2 is the second argument to
The execution name of this program $n the nth parameter value of the program, n=1..9$* all parameters of the program, which can be more than 9 parameters. $# the number of parameters for this program $$ the PID of the program (the current number
1. The common syntax for conditional testing is as follows1, test expression2. [Test expression] #两边需要有空格3, [[Test expression]]4, (test expression))DescriptionThe first and second are equivalent, the third is the extended Test command, and syntax 4
1. Determine the type of all files in the/var/directoryfor files in /var/* ;do if [[ -f $files ]];then echo "$files exists and is a regular file." elif [[ -h $files ]] ;then echo "$files is a symbolic link." elif [[ -d
The Linux shell can be user-defined functions and can be called casually in shell scripts. Shell functions exist in memory, not hard disk files, so it's fast, and the shell can preprocess functions, so the function starts faster than the script.Note:
One, the function in shell script?
The function is to organize a piece of code into a small unit, and give the small unit a name, when the code is used to call the name of the small unit directly.Format: function F_name (){command} function
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