Advanced Features of If-then [[]], [] are used to test (test is divided into numeric comparisons, string comparisons, file parity),[[]] is a keyword , which can be used &&, | |, and other similar C language syntax ; [] is a command that is
In another blog "shell script implementation DB2 database table export to file " implemented through the implementation of the script to export the DB2 database to a file, need to pass in seven parameters, the last is a string with a space, so when
Recently wrote a small program that takes time to traverse as part of a directory#!/bin/bashfor i in {1..30}dodate= ' date +%y/%m/%d-d "$i days Ago" ' Echo $datedoneFor loop, take the date of the last n days.The core isDate= ' Date +%y/%m/%d-d ' $i
The experience of Shell scripting in developmentThis period of time in the development of a program, program output has a lot of logs. Sometimes you need to log to analyze the problem of the error. Separate viewing efficiency is too low to analyze
Open a text editor, create a new file, the extension sh (sh for Shell), the extension does not affect the execution of the script, see the name is good, if you write a shell script in PHP, the extension is good with PHP.Enter some
function allows us to divide a complex function into several modules, which makes the program structure clearer and the code reuse more efficient. Like other programming languages, the Shell supports functions as well. The Shell function must first
The case name in the shell under Linux is similar to the switch in C + +, but cases in the shell are more powerful and complex.1, strong mainly reflected in: Shell in case the keyword can be a string type, and each item can contain regular
Tag: script
[Copyright statement: reprinted. Please retain the Source: blog.csdn.net/gentleliu. Mail: shallnew at 163 dot com]It can be seen from the literal that the paste command and the cut command have the opposite function. The cut command
Method for obtaining the process ID by shell:
I know there are three things I have learned and practiced:
PS-A | grep "cmdname" | awk '{print $1 }'
Pidof "parameter name"
Pgrep "cmdname"
The three running results in bash and busybox ash
Bash environment variables have arbitrary code execution vulnerability: "Using CGI requests can cause remote code execution, which in turn leads to server intrusion, causing serious harm,Patches officially announced are also
You can read the following questions:1. What is the difference between CHMOD and chown?2. Where does cat output the content of the specified file in the path?3. Can CP be replicated between different types?4. How can I view the file size in HDFS?5.
Recently, I sent a peid shell check tool to everyone. Maybe the newbie doesn't know what this is.Let's take a look at its usage.Peid is now the most popular shell check tool. The so-called "shell" is to put a "shield" on the program, which can be
1234567891011121314151617181920212223242526272829303132
[ -a FILE ] IfFILE If yes, it is true.[ -b FILE ] IfFILE If the object exists and is a special file, it is true.[ -c FILE ] IfFILE If a special file exists and is a word, it is
The line starting with "#" is a comment and will be ignored by the interpreter.
Sh does not contain comments from multiple lines. Only one # sign can be added to each line. It can only be like this:
# ------------------------------------------ #
Bash supports many operators, including Arithmetic Operators, Relational operators, boolean operators, string operators, and file test operators.
Native Bash does not support simple mathematical operations, but can be implemented using other
If the expression contains special characters, shell will replace it. For example, using variables in double quotes is a replacement, and escape characters are also a replacement.For example:
Copy text-only new window
#! /Bin/bash
A = 10
Getting started with Shell programming (version 2) (I)Simple example Shell program
Example 1.
#!/bin/bash#This is to show what a shell script looks likeecho "Our first example"echo # This inserts an empty line in output.echo "We are currently in the
Linux shell redirection and shell redirection
Redirects the shell error output to the standard output to record the error information of the script.
For example:
/Root/test. sh> test. log 2> & 1
Note:
Linux first loads/etc/rc. d/rc. local
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