Shell Scripting related

Issue 1: Read the same line of two files simultaneously and insert the rows of two files into the same text# cat aaa1a2a3a4# Cat bbb1b2b3/# vim aa.sh#!/bin/bashwhile read-u3 i && read-u4 j;doecho $i $jdone >cc 3Note that READ-U3 I reads the contents

Linux Shell Condition Test

Conditional test Method OneTest command:if test $n 1-eq $n 2then "Thenumber isequal"fi[] Commandif [$n 1-eq $n 2]then " The number is equal " fiThe test command and [] are equivalent in bash.Condition test Mode Two((expression)) test the

Shell Lookup and substitution

In the shell to find, grep is doomed to escape.Cat file grep Austinis to look in the document for the row where Austin is located.After grep matches the regular expression, the Find function becomes exceptionally powerful.At this point, it's good to

Shell Script--Determine if the IP entered is correct

#!/bin/bash#It ' s written by Caibingsen#!/bin/bash#It ' s written by Caibingsen#date: 2016-03-15#while设置成死循环, re-enter when the IP entered does not meet the criteriaWhile:DoRead-p "Please enter the IP address to be judged:" IP#判断输入的ip地址是否仅由数字和点组成,

Shell Script--Guess number

#!/bin/bash#It ' s written by Caibingsen#Date: 2016-03-15# # Function: Guess the number in the 0-9 range# # Requirements: 1, automatically generate a number each time# # 2, guess wrong five times auto exit# 3, guess the automatic exit# # 4, input

Shell Learning Notes

█ Start line The shell program must start with the following line (must be in the first line of the file)#!/bin/shThe symbol #! is used to tell the system that the parameter behind it is the program used to execute the file █ executable when editing

Shell implementation Trim Function-removes spaces on both sides of the string (including the Tab,space key)

The shell implements the trim function effect to remove spaces on both sides of the string, and the following three commands are equivalent, all of which can be implementedSed ' s/^\s*//' totrim.txt |sed ' s/\s*$//' >trimed.txtSed ' s/^\s*//;s/\s*$//

Create a user with a shell script

Create 20 users with shell script, ask 20 users to specify the home directory as/share/home/, and give each user randomly assigned a password, and finally record these user information in the log![[email protected] sbin]# vim 2.sh          mkdir -p  

HBase Quick Start--shell operation

I. INTRODUCTIONHBase is a distributed, column-oriented, open-source database derived from a Google paper, BigTable: A distributed storage system of structured data. HBase is an open source implementation of Google BigTable, which leverages Hadoop

Restart Tomcat's shell script under the Linux system

Restart the Tomcat shell script under the Linux system: tomcat_home=/opt/apache-tomcat-6.0 . 32 #找到tomcat进程的id并kill掉 ps -ef | grep Tomcat | awk { print $ "} | sed -e s/^/kill-9/g | sh - #删除日志文件, if you don't first delete it, you can leave

Linux Shell Basics (eight)

Eight, shell script sed&awk01.sed using the Flow editor-steam editor#ed/etc/passwd1,10p ... 1s/root/byf/p (replace root for BYF) #sed-E ' s/root/byf/g '/etc/passwd (function as above) just show the content change #sed-e ' s/root/byf/g '/etc/passwd >/

"Shell" intercepts the text in front of a string

For example, there is a file Test.txt, which contains this data.meiguounix232FaguounixRibenunixZhongguounixtaobaoHanguounixbabaNow I want to intercept Unix in front of the data, including UNIX, and output.The data to be obtained should

17th Shell Programming Basics (2)

Shell study1. Exit StatusIf the command executed successfully (or true), the value of $? is zero. If the commandfailed for some reason,$? Would containapositive integer between 1 and 255, inclusive. A failed command usually returns 1.2, testing an

Shell Scripting Exercises

1. List the directory under the current directory (only one level is required)1 #!/bin/bash 2 for f in ' LS ' 3 do 4 if [-D $f] 5 then 6 echo $f 7 fi 8 done2, the current directory of files (only need a level) listed1 #!/bin/bash 2 for f in ' LS ' 3

Linux Learning Note: Shell Foundation regular expressions

Commands frequently used in the shell for regular expressions include grep, sed, awkThe contents of the file used for testing[email protected] ~]# VI testfileCurrent Network StatusLast Updated:mon Feb 10:55:06 CST 2016Updated every secondsNagios

Shell upgrade complete record

[email protected] bash-4.3.30]# cat Makefile |grep Prefixprefix =/usr/localExec_prefix = ${prefix}Datarootdir = ${prefix}/shareBindir = ${exec_prefix}/binLibdir = ${exec_prefix}/libIncludedir = ${prefix}/includePrefix=${prefix}

Shell arrays and dictionaries

Shell arrays and dictionaries#!/bin/bashecho "Shell definition dictionary" #必须先声明declare-A dicdic= ([key1]= "value1" [key2]= "value2" [key3]= "Value3") # Print the specified key Valueecho ${dic["Key1"} #打印所有key值echo ${!dic[*]} #打印所有valueecho ${dic[*]

Sorting algorithm--shell sorting

PrincipleDivides the sorted array into sub-sequences (this depends on the originally set step value), then inserts the sequence directly between the individual sub-sequences, and then the increment (that is, the step value) and then inserts the sort,

Sorting algorithm--shell sorting

PrincipleDivides the sorted array into sub-sequences (this depends on the originally set step value), then inserts the sequence directly between the individual sub-sequences, and then the increment (that is, the step value) and then inserts the sort,

Java calls shell commands and scripts

Shell scripts are powerful and simple when working with text and managing the operating system.Combining shell scripts into your application is a great way to quickly implementThis article describes the use of Java code to invoke and execute the

Total Pages: 541 1 .... 468 469 470 471 472 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.