Shell Programming for Linux

I've been studying this Linux shell program recently because I'm interested in this Linux system, so I've learned the shell programming at once.In fact, this Linux shell programming is a summary of the execution of this overall command, that is, if

Bash reads and writes shell Variables

Special characters Purpose Description $ Variable Get the value of a variable. If it is not initialized, It is null. Returns the value of "variable". If it is not initialized, null is returned. $

Shell programming (13) --- WHILE LOOP

The while loop is applicable to scenarios where the number of loops is unknown.Syntax format: While conditiondo statement ...... Done Note: While is used to execute a loop when the condition is set up. When the condition is invalid, the loop is

Shell script parsing 7 (Exercise 1) ----- Script Parameters

#! /Bin/bashA = $1 # pass the first command line parameter to variable A, and the second command line parameter to BB = $2If [-Z $ A] | [-Z $ B] # determines whether a and B are empty. If one is empty, print the prompt statement and exit.ThenEcho

Shell script used to record the use of commands after Logon

CopyCodeThe Code is as follows: #/bin/bash # History # Paste the following code directly to/etc/profile. User_ip = 'Who-u am I 2>/dev/null | awk '{print $ NF}' | sed-E's/[()] // g'' Histdir =/var/log/. hist If [-Z $ user_ip] Then User_ip =

Shell to view the basic information script of the system

#! /Bin/bashecho "IP:" ifconfig | grep "Inet ADDR" | grep-V 127.0.0.1 | awk '{print $2}' | awk-F ': ''{print $2} 'echo" Product Name: "dmidecode | grep nameecho" CPU info: "dmidecode | grep-I cpu | grep-I version | awk-F ': ''{print $2} 'echo" disk

Shell script creation tool

Every time you create a new script, you must add # In front of the script #! Some fixed text such as/bin/bash. The bash Script Creation script can automatically add information such as Bash and date author. After the creation is complete, the system

Start and Stop the shell script after openvswitch 2.1.2 is installed.

After openvswitch 2.1.2 is installed, it is often possible to start and stop. To avoid repeating the script to start and stop the terminal code, it is best to write it in a different script to facilitate the next call. The premise is that

Shell programming (1) --- Variables

A variable is a memory space. When a variable is referenced by a variable name, it is called a named memory space. To define a variable, assign a fixed memory space to the variable. assign a value to the variable, that is, fill the data in the

Prevents shell from running multiple

I am often very lazy. The main solution to laziness is to use scripts for automatic execution. However, sometimes, for example, processing a piece of data has not been completed, and the next execution starts again, this is a problem. Let's see how

Shell script test (fan Wai) -- jiebao

Jiebao Jiebao Jiebao Jiebao Jiebao This series of scripts has already opened a forum on GitHub. I name it "Easy shell" (Click here to enter ). At present, you have added the scripts in the previous phases. More scripts will be added to

Common shell instances

Tag: Shell 1. Search for all files larger than 500 mb in the current directory, write these file names to a text file, and count the number of files. Find/-size + 500 m-type F | tee/root/file.txt | WC-l or find/-size + 50 m-exec ls

"Notes" "ubuntu" Mint personal shell style script

Alias LL = 'LS-al'Use_color = false# Set colorful PS1 only on colorful terminals.# Dircolors -- print-database uses its own built-in Database# Instead of using/etc/dir_colors. Try to use the external file# First to take advantage of user additions.

Get the shell script code for two date intervals

Copy codeThe Code is as follows :#! /Bin/sh # Obtain the date interval from the first day of the quarter to yesterday # Link: www.jb51.net # Date: 2013/2/28 Day = 'date-d "1 days ago" "+ % Y % m % d "';Year = 'expr substr $ {day} 1 4 ';Month =

Shell script for sending LOG Category numbers via SMS

Copy codeThe Code is as follows :#! /Bin/bash # Telno is used to query the number list file # Sendsms. log is the text message sending result File #1 indicates that the message is successfully sent. Query_sms () { > Submit_telno >

Bash Shell script learning Summary

1. Character truncation: For normal path truncation, you can use the basename and dirname tools:Basename can intercept a file name from a file path. For example: Copy codeThe Code is as follows: $ basename/home/file.tar File.tar Dirname can be

Vulnerability description of shell. application Object

Environment: 2 kserver + iis5 succeeded. The default permission is iusr. Iis permission: script executable Description: by default, the server. createobject method can be used to use installed components on 2 k servers. For example, we all know

Shell signal capturing

Before capturing signals, you must first understand how to use kill: Kill-l view Signal 650) this. width = 650; "title =" kill-l.jpg "src =" http://www.bkjia.com/uploads/allimg/131227/2315524596-0.jpg "alt =" 225340553.jpg"/> Usage: Kill-NUMBER

[Shell] judge the current user

[Shell] judge the current user Determines whether the current user is root. If the user is a root user, if not #!/bin/bash#title: testus.sh#author: orangleliu#date: 2014-08-09#desc: get current user, if it is root user, tell us it is super user or

Automatic Upgrade script (shell)

Overview Multiple duts are usually used during testing, saving a lot of time to upgrade the new version of the work script.Code #! /Bin/bash # download new version, scp to dut and upgrade # author: godlaughing url = $1 wget $ url download_dir

Total Pages: 541 1 .... 529 530 531 532 533 .... 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.