Shell Programming Knowledge Collection _ Basic Tutorial

In the afternoon, when writing a program, you need to assign the value returned by the shell command to a variable, using the a=$ () method soft=$ (grep-i "\ Software \) token/passcode/." 123.txt |wc-l) echo "[+] Soft card total:" $soft ...... The

Multi-command execution in Linux '; ' and ' && ' the difference explains _linux shell

Objective Many commands are executed simultaneously during Linux operations or during day-to-day Linux operation, so that it needs to be handled through our multiple command methods. Multi-order execution includes '; ' And the ' && ' command so

The substitution of several basic commands in a shell script under Linux _linux shell

Part 1: ' Command ' This is the "command standard output as a function of standard input" method of operation, there are great drawbacks and unsafe places. disadvantage one: relatively old. disadvantage two: easy to confuse with single quotes.

A shell script _linux shell that monitors network card traffic

Implementation code: #!/bin/bash eth_in_old=$ (ifconfig eth0|grep "RX bytes" |sed s/rx ' bytes://' |awk ' {print} ') eth_out_old=$ ( Ifconfig eth0|grep "RX bytes" |sed ' s/.*tx bytes://' |awk ' {print $} ') Sleep 1 eth_in_new=$ (ifconfig eth0

Shell script echo output does not wrap function enhancement instance _linux Shell

This is the 8th/101 script There are as many ways to solve this quirky echo problem as There are the pages in this book. One of my favorites is very succinct: function Echon { echo ' $* ' | awk ' {printf '%s ' $} ' } You could prefer to

Wscript.Shell Object Specialfolders Property does not expose document sharing _vbs

Special folder names are used to index the collection to retrieve the special folders that are required, and the following special folders are listed in the document:

Linux some common shell scripts to organize _linux shell

How to calculate the number of files and directories in the current directory # ls-l * |grep "^-" |wc-l----to count files # ls-l * |grep ' ^d ' |wc-l-----to Count dir How do I just column subdirectories? Ls-f | grep/$

The shell script implementation classifies files according to the time the file was modified _linux shell

#!/bin/bash # exctute #/mod.sh File_type input_folder Output_folder #/mod.sh Count I f [! $#-eq 3]; then echo "[ERROR] Error paramater." Exit Fi # File Type file_type= ' ${1} ' # input Foloder if [-d ' ${2} ']; Then folder= "${2}" Else echo

Expect automatic detection and restart program code on another server _linux shell

[s005 you] # cat Haproxy_expect Copy Code code as follows: #!/usr/bin/expect Set Ssh_user "Fivetrees" Set Password "123456" Spawn ssh-i/root/.ssh/$ssh _user Server004.xd.com Expect_before "No"? { Send "yes\r"} Sleep 0.5

An interoperable concurrent ping detection script _linux Shell

Copy Code code as follows: #!/bin/bash #********************************# #2013 -01-11 17:00:00 wanggy Exp # #note:p ing Monitor # #********************************# Set-u Ping_fun () { d_network=192.168.1 Echo-n "Input" network

Using shell.application to get picture resolution _vbs under VBS

Simple Google a bit, not fruit, so sent an email for advice, and soon have a reply. Copy Code code as follows: Path = "C:\test.jpg" arr = Split (Path, "\") FileName = arr (Ubound (arr)) FolderPath = Left (path, Len (path)-Len (FileName)-

Linux bash string processing encyclopedia _linux Shell

Gets the length of the string Copy Code code as follows: Code: %x= "ABCD" #方法一 %expr length $x 4 # method Two %echo ${#x} 4 # method Three %expr "$x": ". *" 4 # Help for expr # String:regexp anchored pattern

Two shell scripts for backup databases _linux shell

A shell script that backs up a database Copy Code code as follows: #!/bin/bash #指定运行的脚本shell #运行脚本要给用户执行权限 Bakdir=/backup Month= ' Date +%m ' day= ' Date +%d ' Year= ' Date +%y ' Hour= ' Date +%k ' min= ' Date +%m '

Linux shell implementations two ways to get user input to a single character in a specified range _linux shell

Method One: Copy Code code as follows: Echo ' echo {a.. Z} ' echo {A.. Z} ' >/tmp/letterfile While Read-p ' please input a letter: ' Letter Todo ((' Awk-v var= "$letter" ' Begin{print length (var)} ' = = 1)) && grep-q

SED deletes script code for one line of content in a file _linux shell

Take a look at the contents of the original file: Copy Code code as follows: Root@localhost ~]# Cat File.txt Hello World A:b:c-h-N A:b:c-h-N SED deletes related rows based on conditions: Copy Code code as follows:

Shell script Register to Linux system service instance _linux shell

Sign up for a system service to boot from. 1 Script Authoring #vim test.sh Copy Code code as follows: #!/bin/bash #description: hello.sh #chkconfig: 2345 20 81 exec_path=/usr/local/ exec=hello.sh daemon=/usr/local/hello.sh

Example of positional variable parameters (special characters) in shell script _linux shell

$#: Number of parameters passed to script$*: Displays all parameters passed to the script in a single string. Unlike positional variables, this option argument can exceed 9$$: The current process ID number of the script run$! : The process ID number

Linux shell script Implementation detects tomcat_linux shell

Linux shell script detects tomcat and restarts automatically Background Run command sh xxx.sh &View background tasks: JobsSummoned to the front desk: FG Jobs number The code that can delete the while loop is put into the crontab, and the script

Shell Script Implementation Monitor iptables run State _linux shell

Recently in the debugging server iptables, oneself made a timed turn off iptables, but at night home rarely open a computer, so can not go to start iptables, of course, you may say, why not cancel timed shutdown iptables, I can only say that

The shell script implements the bulk download resource and retains the original path _linux shell

Sample Resources Listsuch as Url.txt: Copy Code code as follows: Http://su.bdimg.com/static/superplus/img/logo_white_ee663702.png Http://su.bdimg.com/static/superplus/img/logo_white_ee663703.png

Total Pages: 541 1 .... 521 522 523 524 525 .... 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.