1th Shell Basics 1.1 What is a shell
The shell is a command interpreter, which at the outermost of the operating system, is responsible for directly talking to the user, explaining the user's input to the operating system, and processing the output of a wide variety of operating systems, returning the output screen to the user.1.1.1
shell scripts, there is a common way to use if to judge logic, which is case. The specific format is:Case variable invalue1)Command;;value2)Command;;VALUE3)Command;;*)Command;;EsacIn the above structure, there is no limit to the number of values, and * represents a value other than the above. The following author writes a script that determines whether the input value is odd or even.The value of $a is either 1 or 0, and the result is:You can also tak
One: Hello WorldCreate a new file, named after the. sh suffix. Each bash file begins with the first row of table names file type: #!/bin/bashThen enter the code below.For example, the output Hello World:#! /bin/"helloworld"Run Bash file:./file name. sh(Files created at the terminal are saved with vim edit, Ubuntu can be a blank document in the graphical interface, identified as bash file by suffix name)Two: VariablesThe variables defined in the shell
generated file to $ Umask 000, which is changed to 000, and the specific rules refer to the table above.In fact, the value of Umask is set in/etc/profile this configuration file, for a specific user, you can set their own umask in $home/.profile or $home/.bash_profile1.7. Symbolic Link, LnHard links, $ ln resource destinationSoft links, $ ln-s resource destination1.8. Learn the yuanyin of shell scriptsShell scripting is powerful, for example, for a
Simply put, the shell is a file containing several lines of shell or Linux commands. For a large number of commands that are written and used more than once, you can use a separate file to save it for later use. Usually the shell script is suffixed with. SH, and the first line must indicate which shell the system needs
First, declaring variablesMyurl= "http://see.xidian.edu.cn/cpp/linux/"mynum=100Attention:There can be no spaces between the variable name and the equals sign, which may be different from any programming language you are familiar with.At the same time, the name of the variable names must follow the following rules:The first character must be a letter (a-z,a-z).You can use an underscore (_) without spaces in the middle.Punctuation cannot be used.You can
-x//set -x表示跟在该命令后的脚本输出调试信息echo$i//set +x表示从此处禁用调试set +xdoneecho"Script executed"The above code means that only the output echo $i is printed, and the specific debug information output is as follows:[Email Protected]2:~/shelllearning/chapter12#./debug2.sh+Echo 11+Set+x+Echo 22+Set+x+Echo 33+Set+x+Echo 44+Set+x+Echo 55+Set+x+Echo 66+Set+xIn addition to script debugging with the Bash-x command, you can also add the-XV command to the first line of the script, allowing the script to debug by defaul
The shell supports custom variables.Defining variablesWhen defining a variable, the variable name does not have a dollar sign ($), such as:Value= "TMP"Note that there can be no spaces between the variable name and the equals sign, which may be different from any programming language you are familiar with. at the same time, the name of the variable names must follow the following rules:
The first ch
When we talked about the number of scripts being executed in CU a few days ago, we found that we knew little about how to execute commands in shell... thank you for your advice! In addition to being inaccurate in some places, his statement is basically correct. I took the time to find some materials to study these days and learned a lot! Here, I am able to post my thoughts in the form of Q A for your reference. The younger brother is too easy to lear
The shell is an interface that users interact with the kernel, and the most popular shell is now called the Bash shell. The shell is also a programming language , Shell Scripting The original text is discussed with the author: htt
Linux Shell programming learning notes log on to Shell, the Shell program automatically loaded after you log on to the system. Most Linux systems use/bin/bash as the shells that can be used by the Shell system supported by the default logon
the shell script is running, it is in the current shell according to Shebang's instructions that an interpreter (child shell) is opened to interpret the execution code content, and the content of the shell script is implemented in a child shell process;we can use text editi
"Please input your first name:" FirstName #提示用户输入read-P "please input your Las T name: "LastName #提示用户输入echo-E" \nyour full name is: $firstname $lastname "#结果在屏幕输出exit 0First, execute the script in a way that executes directly:As can be seen from the above, the program executes smoothly, then I use the echo command to output the contents of FirstName and LastName, but the output is empty. What is the reason for this? This means that when the child process is complete, the variables or actions i
Tags: common number of regular expressions practice record password description save expression LinuxRegular Expressions text-processing toolLearning Goals:L Mastering the use of regular expressionsL MASTER the use of SED and awk text processing toolsDirectory structure:Regular expression Regular Expressions overviewL Regular Expressions: Use a single string to describe, match a series of strings that conform to a certain syntactic ruleL consists of ordinary characters and special charactersL g
In Linux, shell statement variable programming shell variable 1: Two types of variables: temporary variables and permanent variables temporary variables are defined within the shell program and are only applicable within the program and invisible to other programs. Including user-defined variables and location variable
we can use any kind of text editor, such as Gedit, Kedit, Emacs, VI, etc. to write shell scripts, which must start with the following line (must be placed in the first line of the file):#!/bin/sh...Note: It is best to use "!/bin/bash" instead of "!/bin/sh" if you use TC shell instead of tcsh, other similar. The symbol #! is used to tell the system which program executes the script, and this example uses/bin
Shell Programming I. Introduction to the ProgramProgram程序:算法+数据结构数据结构:数据在计算机中的类型和组织方式算法:处理数据的方式面向过程:以指令为中心,数据服务于指令面向对象:以数据为中心,指令服务于数据计算机:二进制执行Advanced Programming Languages:编译:高级语言->编译器->机器代码->执行解释:高级语言->执行->解释器->机器代码 shellThree major logic顺序、循环、选择Two. shell script 1. Format格式要求:首行shebang机制#!/bin/bash 指定
Linux lab-shell programming
1. view the values of environment variables defined by the user shell in the current system.2. Define the value of the variable AK to 200 and display it on the screen.3. Define the value of the variable AM to 100, and use the test command to compare whether the value is greater than 150.4. Create a simple
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.