Shell special characters: 1. Wildcard character 2. Piping1. Wildcard characters1.1 asterisk (*): matches any length1.2 Question mark (? ): Matches a length of characters1.3 square brackets ([...] ): matches the character specified in it1.4 Square
1. MakefileThe first thing to know is what Makefile is, Makefile is a directive file, which stores custom commands (which can be created with the help of existing commands), and differs from Makefile in different systems, linux/ In UNIX systems, the
1, there are two common ways to run a shell script:First give executable permission, then enter the directory where the file is located, enter:./name.sh;Run the interpreter and execute the script:/bin/sh name.sh, in which case there can be no #! in
I. The existence and judgment of documents-D to determine if the file exists and whether it is a directory file (the directory is true)-E to determine if the file exists (exists as true)-F to determine if the file exists and is a normal file (the
Conditional Select if statement 选择执行: 注意:if语句可嵌套 单分支 if 判断条件;then 条件为真的分支代码 fi 双分支 if 判断条件; then 条件为真的分支代码 else条件为假的分支代码 fi 多分支 if 判断条件1; then 条件为真的分支代码 elif 判断条件2; then 条件为真的分支代码 elif 判断条件3; then
In shell scripts, there are some common special variable representations that need to be known.Here are some of the frequently used special variable representations:$ Current PIN name$ ... Parameters of the incoming script or function (greater than 1
1. Arithmetic operators2. Relational operators3. Boolean operator4. String operator5. FILE-related operatorsArithmetic operatorsThe bash shell does not provide any mechanism to perform simple arithmetic operations, but we can use some other programs,
Shell scripts are especially important in the daily operations, and often we write shel scripts that involve a lot of privacy information, including passwords, which requires the shell script to be encrypted and the results to be executed. The
Shell: 1, local variables: variables available only in the current shell, 2, Environment variables: variables available for the current Shell's child processes 3, Shell variables: some shell Set the special variables, such as: $ $, $ ... These
1. Method 1[CPP]View PlainCopy
#!/bin/bash
For ((i=1;i
Do
Echo $i
Done
Save As For1.shDirect SH for1.shWill error:The Syntax Error:bad for loop variable workaround code is not a mistake for standard bash, because
Symbol
Meaning
;
Command delimiter
#
configuration file comments; Root user command terminal prompt
~
Home Directory CD ~
-
Previous Path CD-Su-linux Switching user
First, Shell Script Foundation1. First ScriptVim first.shThere are three ways to execute scripts, respectively:./first.sh (need to have executable permissions)SH first.sh . first.sh(or source first.sh)2. Redirects and Pipe breaks1) redirected
#!/bin/bashRead-p "Input a dight:"Echo $REPLYDate= ' Date 'echo "DATE is ${date}"Users= ' Who |wc-l 'echo "LOGIN in User is ${users}"up= ' Date;uptime 'echo "Uptime is ${up}"#echo "HELLO world!"#echo "What's Your Name"#read person#echo "HELLO
linux-Shell core and shell relationshipThe kernel is in the shell, interacting with the shell (command line) through the shell#####################################################################################################Shell Viewwhich $SHELL/
1. Basic usage of shell variables and usage of common symbols( 1 ) Change the main prompt to the user's home directory namePS1 value restores default values after re-login.(2) the string DOS file c:>\ $student \* assigning values to variables x ,
2. Correct method1) Use LetVar=1Let "Var+=1"Echo $varThe output is 2, no tragedy this time.Attention:A) I tested let almost support all operators, see an article on the internet said "let does not support + + 、--and comma, (,)", but after I test the
Experiment FourBasic usage of 1.shell variables and usage of common symbols(1) Change the main prompt to the user's home directory name(2) Assign the string dos file c:> $student * to the variable x and display it(3) In the shell command Terminal
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.