The most recent script always needs to be computed, and every time awk is cumbersome, it encapsulates the subtraction of awk, and each time the direct source math.sh is invoked.There are some points to be pointed out so as not to forget in future
In the shell script, you find a problem with the case statement.This method of specifying lowercase letters [A-z] and uppercase letters [A-z] is no use.
The following conditions occur:
Copy Code code as follows:
[Root@station1 ~]#
Create child process, parent process exitsThis is the first step in the process of writing a daemon. Since the daemon is detached from the control terminal, the first step is to create the illusion that a program has been completed in the shell
Iterating and traversing the lines, words, and characters in a file is a very common operation when you are working on a text file. Using a simple loop for iterations, plus a redirection from stdin or files, is the basic way to iterate through the
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
$ #代表了命令行的参数数量, you can look at the following examples:
Copy Code code as follows:
If [$#!= 1]; Then
echo "USAGE: $ tabname"
echo "e.g.: $ cdr_call_20040701"
Exit 1;
Fi
Position parameters $,..., $N, $ #代表了命令行的参数数量,
Using the shell to test the download under Linux, the code is as follows:
Copy Code code as follows:
#!/bin/bash
#date: 20140210
#used for test server download speed
R_host= "188.18.28.19"
R_dir= "/home/test0208/tmp"
r_file= "$r _dir/
I remember last year when I was looking for a job interview, I heard a classmate say that he likes Linux very much, I believe what he said is true, I think the people who like Linux are very happy from the shell script, because it can integrate the
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
In a shell, you can pass arguments to a function when it is called. Inside the function body, the value of the parameter is obtained in the form of $n, for example, the first argument is represented, and the second argument is $ $ ...
Examples of
Ord functions are not provided directly in awk, so when you convert a character to a code, you need to implement it yourself
Copy Code code as follows:
awk ' begin{for (i = 0; i
This mainly constructs the data structure of
There are 3 main types of shell loops, for,while,untilThe Shell's branch judgment is mainly 2 kinds, if,case
A, for loop
Copy Code code as follows:
#!/bin/bash
For file in $ (ls/tmp/test/mytest |grep SH) The//for in format is
Each process will have a PID, and each PID will have a corresponding directory under the/proc directory, which is the implementation of Linux (current kernel 2.6) system.General backdoor procedures, in the PS and other processes to see the tool can
Wrote a shell script, can be used to count the daily access log, and sent to the e-mail to facilitate daily understanding of the site.The script counts:1, the total number of visits2. Total Bandwidth3. Independent Visitor Volume4, access to IP
Renames the current directory's image file in a specific format, as follows:
Copy Code code as follows:
#!/bin/bash
#Filename: rename_photo.sh
Set-x
Count=1
For IMG in *.jpg *.png
Todo
new=image-$count. ${img##*.}
MV
This example describes the Java method for invoking shell commands. Share to everyone for your reference. Specifically as follows:
Recently, the project has such a demand: the system of foreign currency funds after the completion of the dispatch of
Examples of find common usages in LinuxFind Path-option [-print] [-exec-ok command] {} \;The parameters of the Find command;The directory path that the Path:find command looks for. For example, use. To represent the current directory, and/to
Shell commands are generally divided into built-in (self-contained) and exotic (except those that come with the Yum installation later)How to produce a built-in command: $ man Bash 1 (why add a 1 here because of the manual format)The composition of
Create accounts in bulk: Prompts the user to enter the first user name (such as People1) and the last user name (such as People10)[Email protected] ~]# vim useradd2.sh#!/bin/bashRead-p "Please input first User:" FirstuserRead-p "Please input last
Tag: Indicates the return value of the CTR online packet host Images network SRCDetermine which hosts are online in the current network (the ping return value is true, indicating that the host is online)The trap instruction is used to perform the
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.