Replacing a row of records in a property file with a shell scriptAssume a subordinate file demo.propertiesUser.name=testuser.password=123456...............................Requirements: First, you need to replace the value values of User.Name and
1. Real-time view of the shell types used in the current process: recommendedThe code is as follows:PS | grep $$ | awk ' {print $4} '(Note: $$ indicates the shell's process number)2. The most common command to view the shell, but cannot reflect the
Original: Http://note.youdao.com/share/?id=cd2ad6e6d5db2b347f92958efc2bdbc1&type=noteRegular expressions and wildcard characters:First, Introduction:1. A regular expression is used to match a string in a file that matches a condition .contains
1, the variable with = assigned value when the left cannot have spaces. For example , UserName =nihao returns userName: Command not found . Because this place username as a command to deal with. The right approach is to Username=nihao.Careful is the
Shell Script (v)4. Sed and awk(1) SEDA, common parameters#文件编辑工具, text files and standard input can be edited, the standard input is keyboard input,#文件重定向, string, variable, and pipe text.#-n: Do not print all rows to standard output;-e: Resolves
$# 是传给脚本的参数个数$0是脚本本身的名字$1 是传递给该shell脚本的第一个参数$2是传递给该shell脚本的第二个参数[email protected] 是传给脚本的所有参数的列表$* 是以一个单字符串显示所有向脚本传递的参数,与位置变量不同,参数可超过9个$$ 是脚本运行的当前进程ID号$? 是显示最后命令的退出状态,0表示没有错误,其他表示有错误
Difference:@*
Same point: All parameters are
the Nginx service program written by Shell can be added to the/etc/init.d/directory first. chkconfig--add nginxd chkconfig nginxd on Service Nginxd Start Service Nginxd Stop service Nginxd "Restart | Reload | Test | Status " #!/bin/bash#chkconfig:-
The shell is an interpretive programming language.The execution of an interpreted script file:When an interpreted script file is executed, the script file is committed to the kernel. The kernel sees the first line of "#! "#! is called when the
Regular expressions in the shellVbird said that learning Linux, mastering the shell and the regular is equivalent to open the two-channel, after the ability of the growth will be rapid.The Shell's basic learning has been summed up in a blog post:
Detailed description View:(a) Play with Me Linux network services: DNS service--bind (/etc/named.conf,/var/named) settings implementation and interpretation1#! /bin/Bash2ip="10.10.10"3rip="10.10.10"4dn="gr.org"5Name="10.10.10.10"6 7Cat
Subtracts the specified day from the specified date[Email protected] init_env]$ date-d "20150416 3 days" + "%y%m%d%h"2015041912Adds the specified hour to the specified date[Email protected] init_env]$ date-d "20150416 3 hour" +
1. The script determines whether the command output is empty(1) Determine if the string is emptyIf ["$str" = ""]If [x "$str" = x]If [-Z ' $str '] (-n is not null)Note: You have to double quotation marks, or some commands will be error, form a good
PS: Red font is an important part, look carefullyFirst, Shell features1. History view the command record, default records 1000;[Email protected] ~]# history 1 vim/etc/hosts 2 Ifconfig 3 cd/etc/sysconfig/network-scripts/ifcfg-4
First, write a script, let the user input: 1.first name 2.last name, last displayed on the screen: Your full name is: Content#!/bin/bashread-p "Please input your firstname:" firstnameread-p "Please input your lastname:" LASTNAMEECHO-E "your ful L
What to add========================= Gorgeous split-line ====================+ Start haha_test@@ -1397,3 +1399,8 @@ Service poad/system/bin/poad User System Group system oneshot++ #add For Haha_test+service
For loop1. Note Do must wrapFor i in {1..10} do echo $idone2. Note Do must wrapFor I in 1 2 3 4 5 do echo $idone3. Traverse the results of the command outputFor shname in ' ls *.sh ' do echo $shnamedone4. For loops similar to high-level languagesFor
Beijing time July 1 10:00, peanut Shell (hsk.oray.com) company issued a "Peanut Shell remote Management" platform. This platform is mainly used to manage the embedded peanut shell, such as the embedded management of the peanut shell in the Qnap Nas,
Shell script sorting (Bubble Sorting), shell script sorting bubble
#/Bin/basha = (9 84 51 0 345 1 2 34 1 0) # define an array temp = for (I = 0; I
The above is sorted by a custom fixed array, and the following is a user-defined input array.
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