Shell Script notes (i) Concepts and variables

Concepts and Variables I. Understanding shell scriptsThe shell is a command interpreter that executes the commands and programs that the user enters in order (the command that encounters the sub-script, which executes the sub-script first) .The

Variables of Shell programming

Shell Basics What is a shell? Shell is a command-line interpreter The shell is also a very powerful programming language that can invoke Linux commands directly in the shell How the script executes

That's how Linux should learn.--shell Script Basic Application

1. Receive the user's parameters:In order to give the user more flexibility to complete the work requirement, the shell script can pass parameters when executing the command: (command name parameter 1 parameter 2 ... )Shell pre-defined variables:$ $

Server auto-patrol shell script

#!/bin/sh# defines a function that checks the operating system version num_version=$ (UNAME-R) function check_os () {[[  $NUM _version =~  el6 ]] && return 0| | return 1}echo  "##### #CPU使用情况 ######" cpu_hardware=$ (cat /proc/cpuinfo | grep name

Shell script detects IP address

Shell script:A text file that contains some commands or declarations and conforms to a certain formatFormat requirements: First line shebang mechanism#!/bin/bash#!/usr/bin/python#!/usr/bin/perlThe purpose of the shell script is:? Automation common

Linux0 Foundation Depth Parsing Shell Introduction 01

First, Shell introduction------------User|Terminal (equivalent to Bash's interface)|Shell (shell) bash most Linux systems default shell environment|KernelThe user enters the command through the terminal, submits it to the shell, and then invokes the

A script that takes you through the Shell basics

For example, the need to test a batch of IP in the work is still blocked, you need to write a simple script ping test.We need two machines,Virtual Host: centos6.7 systemLocal linux:centos6.5"Virtual Host"Remote to the host, add IP (Learn the script,

Shell special symbols, cut_sort_wc_uniq commands, and Tee_tr_split commands

Shell Special Symbols * Any of any characters ? Any one character # comment Characters \ de-Semantic characters | Pipe character $ variable prefix,!$ combination, regular inside means end of line ; Multiple commands

Shell script implements bulk download of resources and preserves original paths

Sample Resource Listsuch as Url.txt:http://su.bdimg.com/static/superplus/img/logo_white_ee663702.pnghttp:// Su.bdimg.com/static/superplus/img/logo_white_ee663703.pnghttp://su.bdimg.com/static/

A shell script generates a serial number for the client using the server

#!/bin/Bashinterface=`ls/sys/class/net|grepen|awk 'Nr==1{print}'`if[!-e/etc/adserver/.seq.Info]; Then#生成序列号 #时间 #d=`Date+%y%m%d 'mkdir/etc/adserver/D= ' Dmidecode-t0|grep-op'(? '|awk-F':' 'nr==1'|awk-F'/' '{print $3$1$2}'' #批次lot=' on'#mac地址 mac= '

Shell Basics (ii)

echo commandThe echo command for the Shell is the output for the string.#!/bin/shread name #读取标准输入的行echo "$name It is a test" echo-e "yeah! \c "#-E Open escape \c No Line echo" It is a test "printf commandprintf is used as a formatted string, as

Linux Shell string interception and splicing

A string interception of Linux is useful. There are eight ways.Suppose there is a variable var=http://www.linuxidc.com/123.htm 1 # Intercept, delete the left character, and leave the right character.  Echo ${var#*//}where Var is the variable name

"Shell" establishes a script to count the number of currently logged on users

Who commandThe WHO command is to display the user information of the current login system, execute the WHO command to know which users are currently logged into the system, execute the WHO command separately to list the login account, the terminal

Shell finishing (32) = = = Two small examples of nested loops

(1) The shell prints the pattern as shown.650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/07/9D/wKiom1nMh-ygSI1MAAAj5j4UcHs376.png-wh_500x0-wm_ 3-wmp_4-s_3715701053.png "title=" capture. PNG "alt=" Wkiom1nmh-ygsi1maaaj5j4uchs376.png-wh_50

Shell format output nginx compiler parameters

CommandNginx-v > Nginx.txtcat-n nginx.txt | Sed-n ' 5,18p ' | awk ' {$1= ' ";p rint} ' | Sed ' s/^[]*//g ' | TR ' n ' ', ' | Sed-n ' S/,//GP ' | TR "" \ n

2 minutes-implementation of the boot-up nginx boot script (Shell article)

How to quickly write a startup script , mainly through the following several1, logical smoothing can be in TXT file, have pseudo code way, form system, List order, then add code in a little bit Determine if the program is running

Shell reads file rows, columns

Cat ${file} | While Read lineDoecho $ LineDone-------------------------------------------While the read line #每次读取aa a row in the. ListDoEcho $LINE #输出每行的信息Done ${file}-------------------------------------------Reads the first and second columns

Seconds kill Ecshop's front desk write shell 0day

Ecshop known as the largest open-source online shop system, the official introduction of it: "Ecshop online shop system is a set of free open-source web store software, no matter in stability, code optimization, operating efficiency, load capacity,

Shell Getopts Learning

#!/bin/bashwhile getopts I:VH Namedo case $name in i) Opt=1 echo $OPTARG;; V) opt=2 Echo 2;; h) opt=3 echo 3;; *) echo "Invalid arg-$OPTARG";; EsacdoneThe getopts is used in the following form:

Shell Programming Array Summary

Array Summary Directory: Array composition Array Assignment Array output Array case 1. Array compositionThe composition of an array is a collection of elements, using a variable to store multiple elements, to

Total Pages: 541 1 .... 263 264 265 266 267 .... 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.