For is an important loop statement in shell programming:
Syntax 1:
For variable in list
Do
Action
.....
Done
List:
① 'Seq 1 10' #1-10
② {1 .. 10 }## 1-10
③/Etc/rc. d/rc3.d/K * # All files starting with K in the directory will be cycled once.
④
In shell scripts, how does one write a line feed to a file,
Test environment: ubuntu12.04 LTS version
Echo> file.txt,
This method has the same effect on bash and sh at the beginning of the script,
Echo-e> file.txt is only applicable to bash.
Difference between reverse quotation marks (') and $ () in Shell, shell quotation marks
Someone asked today:
Echo 'echo \\\\\\ W' echo $ (echo \\\\\\\ w) Why is the output different?
This leads to another problem: is there a difference between
In Shell, trick, who processes file names with spaces, finally downloaded the books in the post of the 16 Python books on the forum, I found that there were several titles in front of which there was a [author #123] author in automatic order ):#!
Key points for using the find command in shell linux the find command is an important way to find files, and other bash commands can be used to achieve powerful operation results. Let's take a look at the basic components of the find command: find
[Linux] application of reverse quotation marks (') in shellThe quotation mark (') is located at the top of the Tab key of the keyboard and the left side of the key 1. Note the difference between it and the single quotation mark (') on the left side
The usage of "-" in shell tar-cvf-/home | tar-xvf-what is the meaning of the preceding command? In particular, the usage of several specific tar commands-www.2cto.com is not detailed. Copy/home to the current directory. -Cvf, followed by the tar
In shell scripts, the process of legalizing a floating-point value in a shell script seems a little frustrating, however, floating point numbers are just two integers separated by decimal points. Contact the 5th script validint. sh, and you will
In shell, what is the use of quotation marks ($ "string" and $ 'string') and shellstring?
Sometimes you can see $ "$ string" in some service management scripts. After some tests, it is found that $ is the same as $ outside the quotation marks. I
Parentheses are used to run a group of commands,
The command enclosed by () indicates to run in the sub-shell without affecting the current shell environment.The command enclosed by {} indicates that the command is run in the current shell, and
RecommendedArticle:
APIS for file path operations in Shell
Http://www.cnblogs.com/fangkm/archive/2009/04/15/1436674.html
I wanted to sort it out by myself, but I found the above article by Google according to the title of the phenomenon, and I
$0 the execution name of this program $ n the nth parameter value of this program, n = 1 .. 9 $ * all parameters of this program, this option parameter can exceed 9. $ # Number of parameters of the program $ PID of the Program (ID of the current
If you need to perform operations on the base database in shell, you can first create a corresponding function, as shown in figure
Dbstr = "Tigger/pw123 @ orcl"
Exesql (){Sqlplus-S $ dbstr Set autocommit off;$1;Commit;Exit;EOF}
Phonelist = "1325
1. shell script execution Method
There are two ways to execute shell scripts. One is to generate a new shell and then execute the corresponding shell scripts. The other is to execute the shell in the current shell and no longer enable other
Difference between $ * and $ @ in Shell
A little bit about $ * and $ @ is also learned by cainiao.
$ *All location parameters are used as a word.Note: "$ *" must be referenced.$ @It is synonymous with $ *, but each parameter is an independent ""
When developing restful web apis, JSON is generally used as the format for returning data, and debugging using the Curl command is very convenient.But the problem with curl is that the JSON packets that are returned are not formatted, are not
Finally, we will introduce the common loop in shell script design ). The so-called loop is a piece of code in the script that is repeatedly executed under certain conditions.There are three types of commonly used loop in bash shell:** While*A For
Previously wrote a version of the shell decoding URL, the following gives another versionFrom https://gist.github.com/cdown/1163649function UrlEncode () {Local LANG=C for((i=0; i1};i++)); Do if[[ ${1: $i:1} =~ ^[a-za-z0-9\.\~\_\-]$ ]]; Then
Recently writing a shell script, I would like to use a For loop to read the contents of the file, but found that every line in the file has a space, obviously with a for loop does not work, my intention is to read a row of the file content, so
1. Questions: in a variety of programming languages, the weak type of language is quite a lot, on the one hand this "dynamic type" is very convenient to use, while on the other hand, "pit" you do not discuss ~ Common SQL, Shell, AWK will encounter
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.