A common way for Shell to intercept strings

1, get the character from the front 8, the implementation method is as follows:a=123456789$ expr substr $a 1 8$ echo $a |cut-c 1-8echo $$ echo $a |dd Bs=1 count=8 2>/dev/null2. Interception by the specified string(1) The first method:A string after

Shell special variables and forward and backward task switching methods

Echo ' $ Get the file name of the currently executing shell script: ' $Echo ' $n gets the nth parameter value of the currently executing shell script: ' $ ' =$1 ' $ =$2 ' $ ' =$3Echo ' $* gets all the parameters of the currently executing shell

A production shell script

#!/bin/bash#created: 2017.07.21#author: molewan#description: help erp app  upgrade ########################################################## #脚本说明 ################################## ######################### #a, copy the data that needs to be added

Linux shell renders data

Input/Output Display on the monitorRedirect to FileStandard file descriptor0 STDIN Standard Input1 STDOUT Standard output2 STDERR standard error redirect error message when you need to develop a file descriptor Ls-al badfile 2> test11111Ls-al

Linux Shell simple script to modify IP

Tag: Shell Modify IP #!/bin/bash#2017-7-13#by ip_file=/etc/sysconfig/network-scripts/ifcfg-eth0zt= ' grep  "static"   $IP _file|wc -l ' bf_file=/data/ifcfg-eth/' date  "+%y_%m_%d" '/ipaddr= "192.168.25.107" netmask= "255.255.255.0 "Getaway=" 192.168

Shell command getopts Usage

Write shell scripts Common sh test.shThe notation of-M 2-d 3Case script:#!/bin/bashwhile getopts ": a:b:c:" Arg #选项后面的冒号表示该选项需要参数doecho "arg": $arg case $arg in a) echo "a ' s ARG: $OPTARG---$OPTIND "#参数存在 $OPTARG

The shell enters the required user name or password through EOF in the script

The landlord encountered a scene like this:Execute a script locally, log on to the server, but the login server requires a password to implement the password manually in the scriptThe function of EOF can be achieved by:ssh [Email protected] 192.168.

Shell script-Simple Add user

Description: Adds a user name and password through a script, and discards the add if the user name already existsScript Name: test2.txtCd/optlsmkdir SHELLLSCD SHELLLSVI Test2.txtThe script reads as follows:#!/bin/bashid $ &>/dev/null && echo "User $

Shell level Two Menu

Today the weather is cloudy, a little bored, so boring to play like ...#!/bin/bash#date:2017-6-20#version:1.0#author:xcn ([email protected]) menu  () {Cat This article is from the "Little Rookie" blog, please be sure to keep this source

Shell Special variables

Positional variables $ $ Gets the file name of the currently executing shell script, including the script path if the script is executed with a path[[Email protected] shell]# sh n.sh n.sh[[email protected] ~]# sh/shell/n.sh/shell/n.sh[[email

Linux Shell & placed behind the startup parameters to set this process as a background process

& placed after the startup parameter to set this process as a background processBy default, the process is the foreground process, then the shell is occupied, we can not do other operations, for those who do not interact with the process, many times,

Shell Script Collation

Create the user who wrote the file650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/98/E0/wKiom1lBR5_gYB4HAAAoKuZARYU671.png "title=" Screenshot from 2017-06-13 19-44-27.png "alt=" Wkiom1lbr5_gyb4haaaokuzaryu671.png "/>Second, ping 172.25.2

Shell Common monitoring scripts

1. CPU Idle ScriptTop-b-n1 |grep ' Cpu ' |awk ' {print $} ' |sed ' s/%//' |sed ' s/id,//'Assigning values to variablesCpu_id= ' top-b-n1 |grep ' Cpu ' |awk ' {print $} ' |sed ' s/%//' |sed ' s/id,//'Echo $cpu _idIf you only intercept integers, the

Shell Script Usage Tips 2

0--stdin Standard input1--stdout Standard Output2--stderr standard Errorredirectecho "This was a good idea" > Temp.txtTemp.txt content will be emptied first before entering "this is a good idea"Additionalecho "This was a bad idea" >> temp.txtCat

Shell grep Command Daquan

grep: For fuzzy lookups, in standard input or file  Format: grep [option parameter] ... PATTERN | FILE ...Option parameter Description:- E,--extended-regexp PATTERN is an extensible regular expression-E,--regexp=pattern using PATTERN for matching

Run your own shell script

Shell scripts can be directly./**.sh, or bash **.shI use the./**.sh to run a script of my own, and the following error will appear:[Email protected]:~$./pixel. SH bash:. /pixel. SH : Insufficient permissions [email protected]: sudo ./pixel. SH

Shell determines whether a folder or file exists

The folder does not exist and is createdif [!-d "/data/"];thenmkdir/dataelseecho "folder already exists" fiFile exists then deleteif [!-F "/data/filename"];thenecho "file does not exist" Elserm-rf/data/filenamefiDetermine if a folder existsIf [-d

Shell pre-defined functions for Linux

$ $1-n The name of the current shell script the position variable $ #参数的数量 $* the value of all positional variables #? To determine whether the previous command succeeded, 0 for success, The non-0 is the failure---------------------------------------

Shell Application Tips

Shell Application TipsThe shell is a command interpreter, a layer of interaction between the kernel and the kernel. There are many kinds of shells, the one with the prompt that belongs to /bin/bash, and almost all Linux Systems default to this shell.

Shell fourth (bottom)

From Wang Yin: the flaw of UnixI would like to explain my understanding of the nature of Unix philosophy through this article. While I point out a design problem with UNIX, the goal is not to attack the interest of UNIX. Although Unix has a very

Total Pages: 541 1 .... 537 538 539 540 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.