Introduction to parameter passing methods in Shell scripts

1. $ # number of parameters passed to the script2. $ * display all parameter variables passed to the script with a single string. Different from location variables, this option can have more than 9 Parameters3. $ ID of the current process running

Shell Method for reading objects cyclically by row

The common code for linux shell to read files cyclically by line is as follows: #/Bin/bash printf "********************************* * *** \ n "echo" cat file whiel read line "cat test.txt | while read line do echo $ line; done printf "***********

Shell program structure

A simple command Command [-option] [parameter] Command can be an alias, function name, built-in command, external executable program or script Compound Statement of two shell Control Structure ForName[InWord]; DoList; Done For ((Expr1;Expr2;Expr3);

Shell quick search for PHP Trojan Horse

Search for a PHP trojan in one sentence1234567 # find. /-name "*. php "| xargs egrep" phpspy | c99sh | milw0rm | eval (gunerpress | eval (base64_decoolcode | spider_bc ">/tmp/php.txt # grep-r -- include = *. php '[^ a-z] eval ($ _ Post'.>

Shell 10 good habits

Michael Stutz, author of The Linux Cookbook, has summed up 10 good habits based on his years of UNIX experience. I personally think it is really useful. The following is a summary of this article.1. Create a hierarchical Directory: Use the-p option

Shell array Summary

Arrays, as a special data structure, have a place in any programming language. Of course, bashshell is no exception. This article makes a small summary of the shell array.Here we will only discuss the situation of one-dimensional arrays, with regard

Shell implements a simple process monitoring script

#! /Bin/bash NAME = java NOP =/bin/trueDATE = $ (/bin/date + "% Y-% m-% d % H: % M: % S ") ps-ef | awk-F "" '{print $8, $2}' | grep ^ java>/dev/null 2> & 1 case "$? "In0) # It is running in this case so we do nothing. echo "$ NAME is running OK.

View linux traffic code in real time

#!/bin/bash while["1"] do eth=$1 RXpre=$(cat/proc/net/dev|grep$eth|tr:""|awk'{print$2}') TXpre=$(cat/proc/net/dev|grep$eth|tr:""|awk'{print$10}') sleep1 RXnext=$(cat/proc/net/dev|grep$eth|tr:""|awk'{print$2}')

Common CentOS Shell skills awk

Practical features of awk:Like sed, awk also scans files row by row. From the first row to the last row, it searches for the rows matching the specific template and runs the "select" action on these rows. If no action is specified for a template,

Script used to test the connectivity of the host in the specified segment

The question is as follows :#! /Bin/bash# Thescript 'snameis: ********** usetotestthehost *********# Theauthoris: Ro# Theversionis: Ro-4-10LetPIP = $1NetIP = '2017. 192. 1 .'If [$1-gt254]; thenEcho "thefistnumbershocould Elif [$2-gt254]; thenEcho

Monitor simple scripts run by Squid

#! /Bin/sh While sleep 30 Do SquidNum = 'ps-ef | grep squid | grep-v grep | wc-l' # HttpNum = 'netstat-an | grep 0.0.0.0: 80 | grep-v grep | wc-l' #80 Status If [$ SquidNum! = 3]; then /Etc/rc3.duid start Adddate = 'date + % Y-% m-% d' ""

Shell row-by-row File Reading Method

In Linux, there are many methods to read a file row by row. The most common method is the method in the script below, which is the most efficient and the most commonly used method. To give you an intuitive feeling, We will test the execution

Use shell to implement mathematical functions

Recently, scripts always need to be computed. It will be troublesome to use awk each time. It encapsulates the addition, subtraction, multiplication, division, and source math. sh for each call. Some key points should be pointed out to avoid

Common System Monitoring command shell script

As system O & M personnel, it is necessary to monitor important system parameters in real time, such as zombie processes, CPU utilization, memory usage, disk space usage, and system load balancing, based on the latest information, we can determine

Shell Copies files in batches and replaces the File Content

Task Find the file names of all png files in the folder, and copy xxx.html as the file name. html Replace xxx in xxx.html with the file name. Ls | grep. png | sed's/\. png \ * // '|./cp. sh Cp. sh While read ip Do Sed's/xxx/'"$ ip"'/G'

Iptables rules applicable to Centos Web Servers

1234567891011121314151617181920212223ept = "/sbin/iptables" $ IPT -- delete-chain $ EPT -- flush $ ip- p input drop #1 $ ipt-p forward drop #1 $ ipt-p OUTPUT DROP #1 $ IPT-a input-m state -- state RELATED, ESTABLISHED-j ACCEPT #2 $ EPT-a input-p tcp-

Battle against Centos system password cracking

Centos system password cracking GRUB: On the boot loader menu, type [e] to enter the editing mode. You will face a list of pilot projects. Find the line with the output similar to the following: kernel/vmlinuz-2.4.18-0.4 ro root =/dev/hda2 press the

Tmp security settings for logical volumes in CentOS

When Centos is installed without a specified partition by default, the logical volume does not have an independent/tmp, which may cause security risks./dev/shm is also one of the risks. # Dd A 1 GB file, file/. tmpfs Ddif =/dev/zeroof =/. tmpfsbs

Security experts teach you how to design a "Perfect password" under CentOS"

Taking a 10-bit pure letter password as an example, many people may think that hackers will run a calculator, and then each digit counts from a to z to get the correct combination, but this is undoubtedly the most stupid method, and the effect is

How to Prevent hackers using CentOS

Many people are learning about the Linux operating system. When we use the Linux operating system to access the Internet, we may encounter hacker attacks. This article describes some practical techniques for preventing hackers in the Linux operating

Total Pages: 1330 1 .... 974 975 976 977 978 .... 1330 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.