In simple terms, this technique corresponds to the following scenario
Suppose there is text as follows
Copy Code code as follows:
Cccc
Aaaa
bbbb
dddd
bbbb
Cccc
Aaaa
Now it needs to be processed, this is simple,
Find a special embarrassing fact. I worked hard to Baidu data, want to use rewrite to achieve different domain name source station after the failure of automatic jump function, but the whole idea of missing a serious problem.
In my mind, make a
Copy Code code as follows:
#include
#include
int main ()
{
Char castdoutline[1024]; One line of information in the standard output of the PS command
char* pctmp = NULL; A string that points to a space split
Char caselfpid[10]; PID
A: This script runs the machine, the Linux RHEL6B,c,d,... : To be installed zookeeper cluster machine, Linux RHEL6
First, on the machine A that runs the script, determine if SSH can be logged in without a password to the machine b,c,d to install ZK,
A few days ago wrote seven bull demo, with Bash wrote a convenient installation of the script, involving the path-related judgments, from StackOverflow, plus their own practice to tidy up.
Simple version
The following is one of the simplest
1. Use of time-related random numbers
Generate output Unixtimestamp (%s) and current time nanosecond data (%N, accurate to one-seconds) using the data command. )
The former ensures that the output does not repeat in different seconds, and that the
As a Linux SA, many parts of the day-to-day operation of the script, and the server's IP is generally static IP or Mac binding, of course, the latter is relatively cumbersome to operate, and the former we can set the host name, IP information,
Do unix/linux under the development, scripting skill is indispensable, as Shell programming, is also a profound technical field, here in order to learn, write a simple IP address is the legal micro-script program, this small program is also very
1. Judging variables
Copy Code code as follows:
Read-p "Input a word:" Word
if [!-n "$word"]; then
echo "You have not input a word!"
Else
echo "The word you are $word"
Fi
2. Judging input parameters
Copy
The daily analysis of the log of the brothers really can't afford to, often need to give pv,uv, independent IP and some statistics, use C/c++,java can write, the process is such, read the file, scan by line, put the value of the tag into the data
The code is as follows:
Copy Code code as follows:
#! /bin/bash
function Read_file () {
For line in ' cat $ '
Todo
If [' Echo $line |grep ' ^[a-za-z0-9_-]*@[a-za-z_-]*\.[ a-za-z_-]*$ "'];then
echo $line >> Result.txt
Else
There are a lot of ways, and here are three ways to write:
Writing a:
Copy Code code as follows:
#!/bin/bash
While Read line
Todo
Echo $line
Done
Writing two:
Copy Code code as follows:
#!/bin/bash
Cat
Basic knowledge
Shell execution Mode SH xx.sh (file must have R permission) | | ./xx.sh (file must have X permission) Note: Sh xx.sh method is more safeFileName suffix. shShell content Opening #!/bin/bash | | #!/bin/sh | | #!/bin/csh | | #!/bin/ksh
Today on the Internet to see a web connection average time of the shell command, in their own machine tried, found that can not use, incredibly appear awk:fatal:division by zero attempted such a mistake, Mao's own changed the shell command.
Today, my company colleagues to my entire ADSL automatic redial shell, and detect whether connected to, so as to ensure that the internal test server does not drop the net, OK, I sent the script below.
System: CentOS 5.x
Script 1:
Copy Code
Script A (test example 1)
Copy Code code as follows:
#!/bin/bash
Echo ' Your are in the '
Q) Call another script file in the current script file?
Method One: Using sourceScript second (test example 2)
Copy Code code as
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