Introduction:
No matter which operating system you use, you are bound to encounter an application that behaves erratically, locking itself down and refusing to shut it down. In Linux (and Mac), you can force the end of it with a kill command. In
The meaning of the-Z to-D in the conditional judgment in the shell
Copyright Notice: This article original articles for bloggers, repost please indicate the source. If in doubt, please contact me. I'll be appreciated.
Problem Description
In the "[]" test, the result of the judgment is always true for reasons not known.For example:
["$choice" = = "n"-o "$choice" = = "n"] && echo-e "Oh interrupt!" && exit 0
Regardless of what the variable "choice" is, the test
First, here documents (embedded documents)Here, documents. As a way of redirecting, instructs the shell to start reading the output at the current location of the source file until it encounters a text row that contains only one word. All lines of
Requirements:No. 0 Step: Write the simplest shell command interpreter, this program is taken from Apue example 1-5, command can not take parameters.What the trainees need to do is as follows:The command interpreter is first a dead loop.Prints a
When defining a variable, the variable name does not have a dollar sign ($), such as:
$variableName = "Value"
As shown in figure:Note 1:
1. There can be no spaces between the variable name and the equals sign, which may be different from any
${#string}Returns the length of the $string
${string:position}In $string, start extracting substrings from the $position position
${string:position:length}In $string, the $length-length substring is extracted from the $position
Background
Title, using the ng build command on Jenkins to build a angular2 project, the console outputs the following information:
/tmp/hudson3008133988036917430.sh: Line 3:ng: Command not found
Let's examine the possible causes of
Follow the Runoob website tutorial to learn the notesLike other languages, the shell can also contain external scripts. This makes it easy to encapsulate some common code as a standalone file. Shell files contain syntax in two forms
.
1, you can consider/dev/null as a "black hole." It is very equivalent to a write-only file. All the content written to it is lost forever. and trying to read from it is nothing. However,/dev/null is very useful for command lines and scripts.
Alarm SystemFirst, the alarm system main script(Script storage Address:/usr/local/sbin/)1. Create a script to store the directory: mkdir /usr/local/sbin/mon/ 1.1 creating directories for each functional module---storing scripts CD
1 " *.pid " ` 2 for inch $head _files 3 Do 4 ' {print $} ' | Xargs Kill-95 rm-f $file6 DoneCode as aboveExplain:1. Find all the PID files in the./fmsconf Directory2. Traverse the found file3. Start traversing4. Separate explanations:1. Cat
Shell Special character Cut command
Any of any characters? Any one character#注释字符\ de-Semantic characters·| pipe characterCut intercept string-D Specify delimiter-f Specifies the Intercept paragraphBy looking at what we can see,/etc/passwd is
Bash Knowledge Points: File testing[ ][[ ]]TestMonocular test:-e file: Test files exist-A file: Test files exist-F file: Test for normal files-D directory: test for directory files-H file: Test is a linked file-R somefile: Test whether its valid
Reference: Linux commands, editor and Shell programming, advanced Programming for UNIX environmentsBoth exec and source belong to the Bash Internal command (builtins commands), where you can view all the internal command information by entering man
20.16-20.17 functions in the shell
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.
格式: function f_name() {
Windows uploads shell scripts to Linux in a format that is DOS. The DOS mode shell script will no longer run correctly under Linux, and needs to modify the file mode to UNIX. 1 view File Mode method on the Linux server, open the shell script with
Shell function return value, generally in three ways: return, argv, Echo
1) Return StatementThe Return Value of the shell function, which can be the same as that of other languages, returned through the return statement.Example:
#!/bin/bash
Quick query of Linux Shell syntax compiled by myself (comparison using C language syntax)
Although I have learned Linux Shell programming, there are only a few chance to write shell scripts (usually I write more when setting up a development
From: http://bbs.chinaunix.net/viewthread.php? Tid = 446683
Quote:
The original post is published by "net player:
For example, in Linux, you can find grep, egrep, and fgrep programs. The differences are roughly as follows:
* Grep:In traditional
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