Shell script implementation to determine whether the IP address in an IP segment code sharing _linux Shell

Cat ipcalc.sh #!/bin/bash ip=$1 If [-Z $IP] then echo-e "\e[31;42m sh ipcalc.sh IP \e[0m" exit fi while read MASK do min= '/usr/bin/ipcalc $MASK |awk '/hostmin:/{print $} ' max= '/usr/bin/ Ipcalc $MASK |awk '/hostmax:/{print $} ' min= ' echo $min

4 ways to execute a shell script and the difference introduction _linux shell

There are several ways to execute a shell script 1, relative path mode, need to first CD to script path Copy Code code as follows: [Root@banking tmp]# Cd/tmp [Root@banking tmp]#./ceshi.sh Script execution succeeded 2.

How to display Git branch names in the shell prompt _linux Shell

One of the benefits of Git is that the branch management of the code becomes an extremely convenient thing, the branch only retains the difference, does not have to copy any files, does not connect the network, quickly creates, uses is deleted. The

The setting method of ignoring case in Bash shell _linux Shell

Most people will change it when they use Bash, because the default settings are really hard to use. Refer to the following ~/.INPUTRC settings: Copy Code code as follows: # don't show hidden files in the list Set Match-hidden-files off

Methods to get Process IDs in shell scripts _linux shell

Question: I want to know the process ID of the script shell in the run. How do I get the PID in the shell script? When I execute the shell script, it starts a process called a child shell. As a child of the main shell, the child shell runs the

In the shell script, implement switch user and execute command operation _linux Shell

Today, my company colleagues came to me and said that I was going to execute the Python script on the server with another user, but it was always done by the root user in the crontab, so I thought of a lazy way to use the shell script to switch to

Shell implementation of Iptables management script sharing _linux Shell

The previous script is in save mode, now attach the command to a file, so that it can be easily modified two times or somethingThe script is basically like this, we can change with their situation again ~ add function or something.

UNIX programming create prefix fixed temporary file code share _linux Shell

Parameters:Pathname, the path file name of the temporary file is stored, and the manual free () is required.Dir, the path to the temporary file, if the TMPDIR environment variable is not empty, this parameter is ignored and the environment variable

Create a daemon code instance in a template _linux shell

Copy Code code as follows: #include "Wrap.h" #define MYDOMAIN_FLAG "/tmp/.mydomain_log" void Domain_end () {Unlink (Mydomain_flag);} int Domain_init () {int FD;Fd=open (mydomain_flag,o_rdwr| O_creat| o_excl| O_APPEND,0600);if (fd==-1)Err_

Shell script code for file encoding in bulk conversion directory _linux Shell

A case of a batch conversion directory of File encoded shell script code. Requirements Description:As a result of turning Linux from Windows, many original win under the GBK file needs to be converted into UTF8. The following script only judges

Shell Script Landscaping Login Interface decoration chart (including lunar calendar) _linux shell

Today colleagues idle, asked me to help in the Linux login page to add something he thinks is very unique, look at his hair, said to him is very silent, below to see. Script 1: Cat clcal.sh #!/bin/bash # show Chinese lunisolar calender. # 2011

Shell script to implement a variety of ways to arrange the contents of the file (shuffle problem) _linux Shell

Shuffle problem: Wash a pair of poker, what good way? Can be washed evenly, and can wash quickly? What is the efficient implementation of a disorderly arrangement relative to a file? Chinaunix is indeed the place where the Shell masters are

How to use shell programming hollow lattice _linux shell

1. When defining a variable, no spaces can be left on either side of the = number.eg:Gender=femal ———— RightGender =femal ——— –wronggender= femal ——— –wrong2. Conditional test statement [Both sides of the symbol must be left blank.eg:if [$gender =

Methods for deleting duplicate rows in a file in a shell _linux shell

Linux text processing tools are very rich and powerful, such as a file: Copy Code code as follows: Cat Log Www.jb51.net 192.168.1.1 Www.jb51.net 192.168.1.1 Www.jb51.net 192.168.1.2 Ffffffffffffffffff Ffffffffffffffffff

Linux database backup and share _linux Shell via FTP upload script

Copy Code code as follows: #!/bin/bash #author: 505056357@qq.com echo "Backup Job Start" #设置要备份的网站目录, that is, the root directory of the Web site File=/home/wwwroot/default #设置本地备份目录, for storing the packaged files

Automatically generate Linux network adapter configuration script share _linux Shell

Add: This is valid for the first time to add a network card, if you need to repeat the addition and deletion of automatic configuration, you need to change the script, according to the IP a command information to modify. Copy Code code as

Share a useful iptables script (various filtering notation references) _linux shell

This iptables script is good, very practical, according to the actual application can be changed to use their own. Share it for everyone to refer to. The original author anon. The source code is as follows: Copy Code code as follows:

Two ways to shell command substitution _linux Shell

Command substitution means that the Shell executes a command and replaces the command substitution with the result of executing the command. There are two ways to replace a command: 1. Use backtick symbols (i.e. ..., inverted quotes, accented

Some of their common shell scripts share _linux Shell

Wrote a little shell instance of myself, though very small, but all the big programs are stacked up by small modules, programmers must understand a script writing, and I, will only work under Linux, so you can only write Linux shell script, oh, this

Awk implements left, join query, remove duplicate values, and local variables explain examples _linux shell

Recently saw a few good small examples in the forum, for learning awk is still helpful, here in detail A. A LEFT join query in a similar database Copy Code code as follows: [Root@krlcgcms01 mytest]# cat A.txt//a.txt aaa 222 BBB

Total Pages: 541 1 .... 161 162 163 164 165 .... 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.