Common methods for Shell variables

Array manipulation of variables:Reference URL: http://www.jb51.net/article/55253.htm#直接赋值 [[email protected]-Yum Yum. repos.d]# name[0]=Chengd[[email protected]-Yum Yum. repos.d]# name[1]=Xrd[[email protected]-Yum Yum. repos.d]# name[2]=cxx#

Tips for Linux Shell scripts--not updated regularly

This article is intended to accumulate a solution to small problems that are encountered when writing shell scripts at ordinary times. There are occasional updates here for later review and continuation.One, define the default values in the shell

The advanced application of the shell script awk

Demand:Text in the first column of the word typeface, and so on, the second column is added, the final output characters and the final and (for the convenience of final check, gave 1)The text is as follows:Cat test.logabc 1aaa 1bbb 1ddd 1sss 1iii

Shell's common script

1 Batch Create users:#!/bin/bashI=30Groupadd Class2While [$i-le 50]DoIf ID user$i &>/dev/nullThenecho "This user$i is exist"ElseUseradd-g class2 user$i && echo "User$i" | passwd--stdin user$i &>/dev/null && echo "This user$i is created"Fi((i++))Done2

[Shell programming] Preface

1. Purpose(1) Shell knowledge Summary. Good memory is better than bad writing, finishing the relevant shell knowledge and combining their own practical experience to organize, the content will not involve all the knowledge points, will only cover

CENTOS7 Create daemon with shell and set as system service, boot automatically start

The first is to create the shell daemon: (shouhu.sh)#!/bin/bashtest () {        while true         do                 ls ./  >> 123.txt                 sleep 5                              done}case $1 instart)         path= "/root/shouhu.pid"       

About variable settings in the shell

Defining variablesA=Assigning values to variablesA=5' Number equals $ ()[Email protected] ~]# hostnameLocalhost.localdomain[Email protected] ~]# a= ' hostname '[Email protected] ~]# echo $aLocalhost.localdomain${-} to determine whether the variable

Linux Shell nature and how it works

The nature of the shell The shell of the Linux system is equivalent to the "one shell" of the operating system, which is the command language interpreter, which provides the user with an interface to use the operating system. It does not belong to

Summarize the 8 tips you use frequently with shell command line

Original blog, reproduced please indicate the sourceThe shell is the command interpreter.See which shells are supported by this system1 Tab Command completionThis almost every time can be used, for example, I have a file called file.txt, assuming

Shell parameter expansion

Using SH to write small scripts can make the job easier. Part of the content may be more unfamiliar to everyone (at least I am).is the variable related to the expansion, the following are some simple description and use of the method. To make the

Seq in the shell magical

Add 20 users to the CLASS01 group in bulk, the user name begins with STD, ends with a number, format: STD01---STD20Method 1#!/bin/shgroupadd class01a=stdfor ((i=1;iMethod 2:#!/bin/bashgroupadd class01for i in {1..20}doif [$i-lt];thenuseradd "std0$i"-

Shell's awk

Brief introductionAwk is a powerful text analysis tool, with the search for grep and the editing of SED, which is especially powerful when it comes to analyzing data and generating reports. To put it simply, awk reads the file line-by-row, using

Shell Review First chapter

Today to write blog only to find before there is no written, my God, I was asleep ...1, what is a shell?The shell is a unix/linux system with software that acts as an interface between the kernel and the user, reads the user's input command, sends

The Select loop in the shell uses

Select Use AloneCat select01.sh #!/bin/bashecho "which car do you prefer?" Select CAR in Benz Audi volkswagendo Breakdoneecho "you chose $CAR"Run resultsSH select01.sh which car do you prefer?1) Benz2) Audi3? 1You chose BenzSelect and case are used

The shell writes a simple Hanoi

########################################################################## File Name:hanoi.sh# Author:free# Mail: [email protected]# Created time:2017 April 18 Tuesday 14:36 43 seconds##################################################################

Shell uses shell scripts to publish the project

The first time to write shell scripts, no experience, is to write directly, or to go through the process ( ̄▽ ̄) ~*-----------------------------------------------------------------------In general, three steps, let's do it with me.---------------------

Special characters of the shell

Bash is a powerful scripting language, which is the default shell in many Linux occurrences, supports variables and special characters, and looks at what special characters it has:; Command delimiter, you can write multiple commands in one line;;

Java Learning notes-sorting algorithm of hill sort (Shell sort)

The head of the Sunset Building, the voice of the hung, Jiangnan wandering. The Wu hook to see, the railing shot all over, no one will, boarding meaning. --Deng Jiankang and Heart PavilionThe hill algorithm is a sort algorithm proposed by Hill

Shell script Basics--arrays

Q1. ArraysWe know that variables are memory space, each variable can only store a single data, a one-time assignment operation, then encountered some need to continuously store and read the task, if you still rely on the variable for multiple

Shell sequencing of data structures

#SIZE 10Direct Insert Sortvoid Insert_sort () {int i,j;int array[size+1];ARRAY[]={0,12,23,11,55,2,34,18,20,48,22};for (i=2;iArray[0]=array[i];J=i-1;while (Array[0]ARRAY[J+1]=ARRAY[J];j--;}ARRAY[J+1]=ARRAY[0];}}Binary Insert Sortvoid

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.