Operation of variables in shell programming (Shell 06)

Mainly includes the following 3String manipulationMathematical operationsFloating point ArithmeticOne. String manipulationConnection of StringsConnection Word 2 strings do not need any connectors, write next to each otherLength acquisition  Expr

Shell scripts for daily use

gpg

1, shell implementation without password loginhost=$1ssh-copy-ID"Password: " "123456\r"expect eofeof2. A node-categorized shell scriptnetwork="eth0"host1=`uname-N ' base=`uname-n|Cut-C1-3' Id1=`uname-n|Cut-C4-6`if((Ten# $id 12==1)); Then((Id2=Ten# $

Share a shell script that prevents the script from starting repeatedly

One of the requirements of the project: to prevent the script from repeating the schedule, causing the simultaneous runtime to conflict with each other, you need to create a file before the script runs and delete it at the end. When the script

Description of special variable $0,$?,$!,$*,$#,$1~ $n of shell species

Special variables:$?: The execution result of the previous command returns a value of 0-255,0 for execution success, and other values indicate unsuccessful execution$!:shell PID of the last running background processPID of the $$:shell itself$:

Create a shell with a case statement (function is open, close, reset, display virtual machine)

Create a shell with a case statement (function is open, close, reset, display virtual machine)#!/bin/bashCase "$" inStart)/* When the keyword is start, execute the statement that opens the virtual machineecho Start ...Virsh Start $

Shell programming (i)--common variables and expressions

$? Represents the return value for executing the previous command: If 0 means execution succeeds, non 0 means execution fails$, $ 、。。。 Represents the parameter 1, parameter 2, respectively 、。。。$# indicates the number of parameters for this program$*/

Shell echo Command

Echo is an internal command of the shell that prints the specified string on the screen. Command format: Echo Arg You can use echo to achieve more complex output format control.Show escape characters echo "\"It is a test\ ""

Shell command Find

IntroducedFind命令的工作方式:沿着文件层次结构向下遍历,匹配符合条件的文件,并执行相应的操作。Options-print: Indicates the file name (path) to print out the matching file. When using-print, ' \ n ' as the delimiter used to separate files-print0: Indicates that each matching file name is

Linux Shell intercepts strings

Linux Shell intercepts strings There are many ways to intercept strings in the shell${var#*/}${var##*/}${var%/*}${var%%/*}${var:start:len}${var:start}${var:0-start : Len}${var:0-start} Here are a few examples to illustrate:1) Get the

Shell Note 8

A function is the name of a command or a set of commands. Functions can make the program modular, thus improving efficiency. The shell stores functions in memory rather than in disk files, so accessing the function is much faster than accessing

Operation of shell scripts, etc.

1, command substitution: 'Inverted single quotes, also called heavy notes. On the keyboard and the ~ key together of the key yo, do not knock into single quotation marks.AAfter using ", the shell first replaces the date command enclosed in the

Linux+shell Administrator's Good helper--batch decompression

Linux+shell Administrator's Good helper--batch decompressionRecently, the company has been busy with OA on-line work, as an administrator, it is necessary to provide them with data backup and recovery operations, the main operation is to restore the

The IF statement for Linux shell programming

-eq equals-ne Not equal to-GT Greater than-lt less than-le less than or equal to-ge greater than or equal to-Z Empty string= Two characters equal! = Two characters are not equal-N Non-empty stringStrings are commonly used to check user input,

To partition a hard disk using Shell scripting Automation

In a Linux system, you can use FDISK to partition the hard disk, but to manually execute a lot of commands, it is cumbersome to use, and now remember that a script with Fdisk is automatically executed.1 #make Partition2Ddif=/dev/zero OF=/DEV/MMCBLK1

Shell gets CPU usage

The shell script obtains a method for each CPU usage of the host.#!/bin/Bashinterval=3Cpu_num=`Cat/proc/Stat|grepcpu[0-9] -C ' Start_idle=() Start_total=() cpu_rate=() Cpu_rate_file=./`hostname' _cpu_rate.csvif[-F ${cpu_rate_file}]; Then

Execution of shell scripts and files

1. Shell Script ProgramThe shell is the "shell" of the operating system, and the shell provides users with a human-computer interface. All the user's actions on the computer and the data that the computer obtains are managed by the shell.Shell

Shell Programming service scripting, file lock, and signal capture

Shell scripting is an essential skill for Linux OPS engineers and a very important skill, so it's only good to learn shell programming well. Basic grammar I will not speak, learn the C language of these languages, a little bit to understand the

Shell ${} usage

Suppose we define a variable as:File=/dir1/dir2/dir3/my.file.txtWe can replace each other with ${} to get different values:${file#*/}: Take out the first/its left string: dir1/dir2/dir3/my.file.txt${file##*/}: Take out the last/and left string:

Function of Shell programming

functions: Function functions are statement blocks consisting of several shell commands for code reuse and modular programming1) Definition of function:Can be defined in the command line, part of the script, only in a separate file of the

Array of shell scripts and Yum "Down"

Array of shell scripts and Yum "Down"ArrayVariables: Storing the memory space of a single elementArray: A contiguous memory space that stores multiple elements, equivalent to a collection of multiple variables.Array name and IndexIndex: Numbering

Total Pages: 541 1 .... 193 194 195 196 197 .... 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.