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

Shell script timed task--log compression (delete)

A problem encountered earlier is that the log file is too large to occupy the disk space and cause the build project to fail So I wanted to write a timed task. Delete a log or compress a log file I've been on the internet for a long time and haven't

Shell monitors Java processes and recovers automatically

In a production environment, there is usually a large number of resident processes in a cluster, and it is necessary to be able to monitor and recover quickly when a process hangs. The general Operation Engineer will choose to implement in Python,

"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,

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

Do not fully defragment the shell statements in makefile (mainly for utility only)

1. Some common functions Wildcard wildcard is a pattern matching function, the function model is roughly $ (wildcard parameter), the function's return value is the file that is actually found after the match, or other, depending on the argument,

Backing up the database regularly through the shell

Demand: Daily 2:10 back up the database zhengdb to/data/backup/db. The start and end of the backup can give the appropriate information. The backup file identity standard is the backup time as the file name, and packaged into a. tar.

Linux Shell Example (ii)

First, regular expressionA, the basic regular expression Meta character Description . Match any single character * Match any of its preceding characters any time .*

Linux Shell Learning

Var=value//This is a value assignment.Note that there is no space between the variable and the value, otherwise it will be considered equivalent judgment, such as [var = valu E]//equivalent judgment, the space is particularly important!!!#!/bin/SHCD

Shell Programming in CentOS

1.shell is a batch program, similar to the Windows BAT file2. When writing the shell, the first line should be #! /bin/bash begins Execute the file using the bash shell.3. Use the # comment (preferably note the function of the shell script in case

Shell Programming flow control (conditional statements and loop statements)

1 If ... else ...Basic Format:If conditionThenCommendElseCommendFi     Of course you can write to a line, use [] to indicate the boundary, or to indicate a branch. For example:  if [ $ (ps -ef | grep -c "SSH" ) -gt 1 ];then echo "true" ; fi   

For loop of shell scripts

There are many types of for loops in shell scripts, and a brief summary of the following is done today.1. Cyclic Digital#!/bin/bash for((i=1; i; i++)); do Echo $ (expr31); Done #!/bin/bash for i in $ (seq 1 10 ) do echo $ (expr $i

Shell intercepts the content between the specified strings

#!/bin/bash#截取字符串#path =ss/usr/share/src/root/home/adminPath=ss/usr/share/src/root/home/admin/src/addEcho $pathEcho ${path%src*} #从右向左截取第一个 the string after SRCEcho ${path}Echo ${path%/*} intercepts the first/second string from right to leftEcho

Shell Change Programming One

A 1.shell programming language is a dynamic language (a weakly typed language) that interprets side execution at run time, does not need to be declared before it is used, is declared in use, and does not even differentiate between variable types,

Process Control keywords in the shell

If...elseif [$1x = = "AB" x]; Then echo ' You had enter AB ' elif [$1x = = ' CD ' x]; then echo ' You had enter CD ' Else echo ' You had enter UNEXPE CTED word "fi  Case...esacA switch case similar to another language, however, here is a

Special variables in the shell

$: The file name of the current execution script$n: N is the natural number, the first parameter is $ A, the second argument is $, and so on$#: Number of parameters$*: All parameters, a string, for example,./a.sh 1 2 3, then $* is "1 2 3"[Email

Shell Error Output redirection

Turn from: Https://www.cnblogs.com/vijayfly/p/6234575.htmlshell redirect standard error output to a different locationThe following forms of command invocation can often be found in some scripts, especially when Crontab is called:/tmp/test.sh

MacOS Shell Programming Notes

2. MacOS does not support ll (need to use LS-L implementation), in fact ll under Linux is ls-l shortcut keys.LS Displays the file in the current directory.LS-L Displays the file details in the current directory.#以下命令均不包含 ".", "..." Directories, and

Total Pages: 541 1 .... 534 535 536 537 538 .... 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.