Array definition of shell

Original address: http://blog.chinaunix.net/u/21908/showart.php?id=1420565 reference * Learn Bash Shell 3rd edition 6.4. Arrays You can also use array variables in Bash, which are assigned two types of values:(1) name = (value1 ... valuen) at this

Three methods of string segmentation in shell

Question: For string output such as ' 1,2,3,4,5 ', separate 1 2 3 4 5 Feature: no spaces in string Workaround 1: #!/bin/bash var= ' 1,2,3,4,5 ' var=${var//,/} #这里是将var中的, replace with space for element in $var do echo $ Element done

Shell Scripting Basics-writing runs

Write: The shell script is actually a plain text file (ASCII), and we can edit the file to help us execute multiple instructions at a time, or use some operational and logical judgments to help us achieve certain functions. The same considerations

Various judgments of shell scripts

1. String judgment STR1 = str2 When two strings have the same content, the length is true STR1!= str2 is true when strings str1 and str2 are unequal -N str1 True when the length of the string is greater than 0 (string not empty) -Z str1 True when

Shell programming implements kill thread __ programming

[Root@centos65 liumengyang]# cat test.sh #!/bin/sh #if The process Exists,kill it pid=$ (Ps-ef|grep java| awk ' {print $} ') pidname=$ (ps-ef|grep java|grep-v ' grep ' |awk ' {print} ') #judge If the process is Running.if Not,restart. If

Shell Sort Command-sort

The sort command sorts multiple rows of data in a behavior unit.For example, there is a text file Test_sort, which has five elements, using the sort command, the five elements can be sorted in dictionary order from small to large.If the sort command

"Shell script Learning" shift command learning

Positional parameters can be moved left with the shift command. For example, shift 3 means that the original $ $ is now $, the original $ $, and so on, the original $ $, $ $, $ $ no move. The shift command with no parameters is equal to shift

Two ways to encrypt a Linux shell __linux

Gzexe Installation and use The system is self-contained with no installation required.Use the following command to encrypt: Gzexe tesh.sh After the encryption is complete, test.sh is the encrypted file, while the source file is backed up as test.

Linux SHELL Programming Basics (2) __ Block chain

After you understand the basic statements, you need to implement your own ideas. Start to do some judgment on the condition of learning. Test Test is an expression of a shell program that can be conveniently tested with strings, file states and

Linux shell Remote execution command __linux

Often to deploy multiple servers above the application, if a machine's login too cumbersome. All just think about writing a script to deploy different servers Prerequisites: Configuring SSH Login Free If not, please join me in another article http://

Linux uses shell scripts and cron to implement timed backups, uploads, and garbage-log Cleanup (original) __linux

1. Edit detailappbackup.sh Input: #!/bin/sh#copyright (c) 2010-2011 Luoch (luocheng.cn@luocheng.cn) #Backup The detail files and update, clear logs#version 0 .1.1echo "= = Start deleting logs = =" Rm-vf ' find/opt/apache/htdocs/detail/app/log-name '

"Shell" condition

First, there is only one type of string in the shell, no shaping or floating-point type. However, when you define a variable, you can use single quotes, double quotes, and no quotes. Without quotes, if the variable has a white character inside it,

Bashdb Debug Shell Script

Recently started to learn bash shell, I do not know where to start, do not know what a good tool package to learn it. First Look for: yao@wuyao:~$ Apt-cache Search BashApparix-console-based Bookmark Tool for fast file system navigationBackup-manager-

disconf Java Boot shell

1. startup file: service-restart.sh #!/bin/sh # java ENV source/etc/profile export java_home=/usr/local/jdk1.7.0_75 export jre_home= $JAVA _home/jre if [$# != 3]; Then echo "USAGE: $ service_dir service_name_pre disconf_env" echo "e.g.:

Small knowledge of shell programming

First, the user login into the system after the system environment variables: $HOME user's own directory $PATH directory to search for when executing commands $TZ Time Zone $MAILCHECK every few seconds to check for new letters $PS 1 The prompt

Shell script Implementation Delete data in expired database __ Database

An application system every day to insert data to the database, and for very early data need to be cleaned from the database, to prevent unlimited data increase, the cost of storage and impact data query efficiency. Implemented through two files,

Use of expr in the Shell

The 1.expr command is generally used for integer values in the general format: Expr argument operator argument The general usage is to do arithmetic operations using expr, such as: [Root@centos ~]# expr 10 + 20 30 $expr 30/3/2 5 (Note that operators

Shell to bulk modify file name under Directory

Shell to bulk modify file name under folder: Parameters: Incoming file path, such as: $./batch_rename_files.bat /home/xx/channel/ #!/bin/bash echo "Start programming ..." # #for i in ' ls * ' CD $ # #for i in ' ls-r | grep "erl*" '

First knowledge of the shell

First, the shell concept shell本身是一个用C语言编写的程序,它是Linux系统的用户界面,提供了用户与内核进行交互操作的一种接口。shell既是一种命令语言,又是一种程序设计语言。作为命令语言,它交互式地解释和执行用户输入的命令;作为程序设计语言,定义了各种变量和参数,并提供了许多在高级语言中才具有的控制结构,包括循环和分支。 它虽然不是Unix/Linux系统内核的一部分,但它调用了系统核心的大部分功能来执行程序、建立文件并以并行的方式协调各个程序的运行。

Numerical operations of Shell programming

Declare-r variable name = variable 1+ variable 2[Email protected] test]# aa=11[Email protected] test]# bb=22[Email protected] test]# declare-i cc= $aa + $bb[Email protected] test]# echo $CC33[[email protected] test]# dd=$ (expr $aa + $bb) Note:

Total Pages: 541 1 .... 513 514 515 516 517 .... 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.