String handling of Shell programmingIn the shell, because it is a weakly typed language, all variables are strings without declaring the variable type beforehand. So the processing of strings is very important.The following are common operations on
Serial number
Task
Command combination
1
Delete a 0-byte file
Find. -type f-size 0-exec rm-rf {} \;Find. Type F-size 0-delete
2
View processes, sorted by memory from large to small
PS-E-O "%c:
The syntax for the most streamlined if command is:if TEST-COMMANDS; then CONSEQUENT-COMMANDS; fiafter the Test-command executes and its return status is 0, the consequent-commands executes. The return status is the exit state of the last command, or
. (){ .|. &};. Or:() {:|:&};:These 13 characters by Jaromil, in 2002 designed the most streamlined implementation of a fork bomb.. () Note the following to define a function, the function name is a decimal point, no optional parameters;{denotes the
Write the name Auto_change_ gw.sh script, used to automatically switch the host gateway, the instructions are as follows: 1) There are 2 available gateway addresses, respectively, the primary gateway 192.168.10.254 and the standby gateway 192.168.10.
Linux shell script output with color textThe color of the text terminal can be generated by using the ANSI unconventional character sequence.Example: "Echo-e \033[44;37;5m BLUE \033[0m""Echo-e \033[44;37;5m BLUE \033[0m BLACK"The area that needs to
12. Sort commands for Rowssort:1. Sort command-line options:
Options
Describe
-T
Separators between fields
-F
Ignore case when sorting based on character
-K
Define
Microsoft's recent open positions:JOB Posting Title:senior Software development EngineerLocation:china, BeijingDivision:operations System Group EngineeringGroup OverviewOSG is delivering flagship products in Microsoft. Second largest economy in the
Tag: Shell
PS: Today I added an O & M group, Hi brother .. I have to answer questions .. Then
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/3E/00/wKioL1PF9FqRrUCKAABsKQiTqns966.jpg "Title =" qq 40716113536.jpg "alt ="
1. Name the variable
Num = 2 Echo "this is {$ num} Nd"
Output this is 2nd
2. Variable addition the default value is string addition.
Var = 1var = $ var + 1 echo $ VaR
Output 1 + 1
3. How to add mathematics:
Let "Var + = 1" Var = "$ [$ var + 1]
Wscript. shell is the progid of the wshshell object. You can create a wshshell object to run programs, operate the registry, create shortcuts, access system folders, and manage environment variables.
This object has a run method.Run method to create
System# Uname-A # view kernel/operating system/CPU Information# Head-N 1/etc/issue # view the operating system version# Cat/proc/cpuinfo # view CPU Information# Hostname # view the computer name# Lspci-TV # list all PCI devices# Lsusb-TV # list all
The host may be down, or there may be a problem with the network connection.
Sometimes such problems can also be caused by a misconfigured firewall.
The following problems may occur:
1. SSH is not installed when centos is installed.
2.
1. Introduction to IFS
The shell script has an internal domain separator called ifs (internal field seprator. The complete definition is the shell uses the value stored in IFS, which is the space, tab, and newline characters by default, to delimit
Requirement: create 10 SYSTEM account oldboy01-oldboy10 in batches and set to generate password (different password ).
Implementation script:
#!/bin/bash#Question3for i in $(seq -w 10)do useradd -s /bin/bash oldboy$i echo "password$i"
Background:Access to Site Resources outside China is sometimes very slow. an occasional download is certainly tolerable. It is a wise decision to build an image site for multiple use or internal use by a small team.This section uses the yum source
(Linux shell) Chapter 2-joy of command (1), linuxshell
This article is from my personal blog: (linux shell) Chapter 2 -- joy of command (1)
In the previous chapter, we described some syntaxes that need to be paid attention to in linux shell. Next we
Shell script automated testing framework, shellscript
Development background of shUnit2
ShUnit2 is developed based on the log4sh SHELL automated testing. It is used in a similar way as JUnit.
Preparation
1. Download shUnit2
Wget-P ~ /Download http://
Because the application of shell is not too long and has never touched on arrays in actual projects, we need to convert something like a = 1, 2, 4, and so on today. We used awk to retrieve them separately. So today I want to see if there is a better
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