Post a shell script for future reference.

1#! /bin/Bash2 3icms_path=$ (CD $ (dirname$0);pwd)4deploy_path=$ (CD $ (dirname$ICMS _path);pwd)5jar_file= $DEPLOY _path'/dailydata-1.0-snapshot.jar'6ini_file= $DEPLOY _path'/cnedmp_etl.ini'7log_file= $DEPLOY _path'/shellrun.log'8coding='GB2312'9

Using the return value of a function in a shell script

#!/bin/bash- function mytest () { echo "arg1 = $" If [$ = "1"]; then return 1 else return 0 fi}if MyTest 2; Then echo "Aaaaaaaaaa" fi Execution Result:Change it a little bit.#!/bin/bash-function mytest

Tips for Shell

Tips for ShellThere'll is some case-based tips for Shell.1. Replace The sequence space with newlineInput Examplea b c dOutput ExampleabcdSummarysedis the best solution.Solutionsed -r -e ‘s/[[:space:]]/\n/g‘2. Sort the unordered word list (with

Common shell commands

1. See if a program is running ps–ef|greptomcat 查看所有有关tomcat的进程 2. Terminating a thread kill-9 2222  3. View files, including hidden files ls-al 4.

Shell commands used in a development

1. Time CalculationStarttime= 'Date+'%y-%m-%d%h:%m:%s''; Endtime=`Date+'%y-%m-%d%h:%m:%s''; Start_seconds=$(Date--Date="$starttime"+%s); End_seconds=$(Date--Date="$endtime"+%s);EchoEnd_seconds-start_seconds2. Get the status code returned by the

Shell String Segmentation

Syntax 1:substring=${string:start:len}The subscript of string starts with 0, with start, but the Len character is truncated and assigned to substring1 #!/bin/bash2 #substr =${string: Start:len}3 str=" 123456789 " 4 substr=${str:3:3}5echo $substr6 7

To provide the old boy learn Linux OPS Shell programming in the fifth chapter of the source code

The fourth chapter is about the shell variable knowledge advanced and practice;The fifth chapter is about the numerical calculation practice of variables;The annex includes the source code, please download.The two chapters should pay attention to

Shell Date Command Detailed

  Format: Date [options] ... [+ format]Option Description:-D,--date= string displays the time described by the specified stringFormat Description:Example 1:#!/bin/bash##1. Gets the current system time yyyy-mm-DD HH:MM:SSv_time_eq=`Date "+%f%T"'

Initial knowledge of Shell environment variables (sixth chapter)

1. The concept of environmental variablesEnvironment variables are used to store shell sessions and work environments, allowing the shell to easily access the program in the set value, environment variables are divided into global variables and

Whether the shell's judgment file exists

#!/bin/SHMyPath="/var/log/httpd/"MyFile="/var/log/httpd/access.log"#这里的-The x parameter determines whether the $mypath exists and has executable permissionsif[!-X"$myPath"]; Then    mkdir "$myPath" fi#这里的-d parameter to determine if $mypath

Common shell Scripts

#!/bin/bash # Check if the 192.168.1.1-192.168.1.254 host is aliveFor IP in 192.168.1. {1..254};DoIf ping-c 1 $ip >/dev/null; Thenecho "$ip OK."Elseecho "$ip no!"FiDone#!/bin/bash #检查多个域名是否可以访问Url= "www.baidu.com www.sina.com www.jd.com"for URL in

"Shell Programming" 2, syntax

First, declaring variablesMyurl= "http://see.xidian.edu.cn/cpp/linux/"mynum=100Attention:There can be no spaces between the variable name and the equals sign, which may be different from any programming language you are familiar with.At the same

How a shell script executes multiple commands under Linux

1. Separate each command;Note: The execution of each command will not affect the execution of other commands. In other words, each command executes,However, there is no guarantee that each command will execute successfully.2. Separate && between

Connectors in the shell (and, and, or)

&& (and) with the || (OR) with the ; (and)A semicolon has just been mentioned above for the delimiter between multiple commands. There are also two special symbols that can be used in the middle of multiple commands, that is, "&&" and "| |" are all

Shell Cut Command

Meaning: Split the file by column according to the delimiterSyntax format: cut [options] ... [File] ...-C, --characters by character-F,--fields by column-D,--delimiter specifies delimiter, default is tab (\ t)Example: viewing file contents Cat

Shell numerical calculation

The assignment and operation in the shell is the string processing by default, here are some special methods of mathematical operation in the shell, which can be seen later, hehe.1. Examples of error methodsAVar=1+1Echo $varThe result of the output

On-my-zsh pretty shell.

OneHttp://www.cnblogs.com/GarveyCalvin/p/4301235.htmlTwoForeword: Zsh can be configured strong, user can customize the configuration, personalization is strong. Zsh Tab Completion is more powerful, this feature allows us to save a lot of time. Zsh

Shell Test command, Loop statement

Test command, Loop statementTest command format:Test conditionUsually, in the If-then-else statement, [] instead, that is, [condition]. Note that there are spaces on both sides of the square brackets.Common commands:-a two conditions at the same

One of the shell programming

Here are some of the two major points to know. The following is the point:First, hardware, core, and Shell.1. Hardware: Of course, your hardware is equipped.2. Core management: The core of the operating system.3. Application: Graphical interface

Data structure and algorithm--advanced sort: Shell sort and quick sort "to be Continued"

Advanced sorting is much faster than simple sorting, the time complexity of simple sorting is O (n^2), and Hill (shell) sorts O (n (logn) ^2), and quick Sort is O (N*logn).Note: The following is an example of a small to large sort of an int

Total Pages: 541 1 .... 313 314 315 316 317 .... 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.