The Until loop executes a series of commands until the condition is true. The Until loop and the while loop are just the opposite of the processing mode. The general while loop is better than the until loop, but at some point it is only rare that the until loop is more useful.The Until loop format is:Until Commanddo Statement (s) to being executed until command is TruedoneThe command is usually a conditional expression, and if the return value is false, the statement in the loop body continues
First part: Linux command line"Linux command line and Shell Scripting Encyclopedia" chapter I: the first knowledge of Linux shell"Linux command line and Shell Scripting Encyclopedia" chapter II: Into the shell"Linux command line a
2 3
Do
For var2 in 0 5
Do
if [ $var 1 -eq 2-a $var 2 -eq 0 ] /c0>
Then
break 2
Else
Echo "$var 1 $var 2"
fi
Done
Done
As above, break 2 means to jump out of the outer loop directly. Operation Result:1 01 5Continue commandThe continue command is similar to the break command, with only a little difference, and it does not jump out of all loops and just jumps out of the current loop.To modify the above example:
#!/bin/bash
While :
Do
echo- n "Input a num
] ~]# Expr 2 * 3expr:syntax errorSecond, let command[[email protected] ~]# let A=2+3[[email protected] ~]# echo $a 5[[email protected] ~]# let A=2-3[[email protected] ~]# Echo $a -1[[email protected] ~]# let A=2*3[[email protected] ~]# echo $a 6[[email protected] ~]# let A=2/3[[email protected] ~]# echo $a 0[[email protected] ~]# b=4[[email protected] ~]# c=2[[email protected] ~]# let a= $b/$c [[email protected] ~]# Echo $a 2When using let, it is generally necessary to assign them to a variable
Tags: Ash programming Daquan status Session $ home Directory str ReferenceYou can encapsulate the shell script code in a function so that it can be used more than once anywhere in the script.17.1 Basic Scripting functionsFunction: is a block of script code that can be named and reused anywhere in the code.17.1.1 Creating a functionThere are two types of formats: Name is the function name1)Function name{Comm
What is a shell script
Shell scripting (English: Shell script), also known as shell Command Draft, programmatic script, is a computer program and text file, the contents of a series of shell commands, through the Unix
What is a shell script sample
Let's look at an example:
#!/bin/sh
cd ~
mkdir shell_tut
cd shell_tut
for ((i=0; i
Example explanation
Line 1th: Specify the script interpreter, here is the interpreter with/bin/sh
Line 2nd: Switch to the current user's home directory
Line 3rd: Create a directory Shell_tut
Line 4th: Switch to the Shell_tut directory
Line 5th: Cycle conditions, 10 cycles
operational experience summary, a comprehensive and systematic explanation of operations in the Shell programming required knowledge points and shell programming of various enterprise-class case, not only to explain the shell programming involved in the various core technology points, Also use shell programming for th
zero-based and 1970/1/1/00:00:00 UTC.
The temporary file/tmp is then introduced in a section. In general, to solve the temporary files generated by their own programs, the shared directory or multiple instances of the same program may cause temporary file naming conflicts, typically using the process ID, can be in the shell variable
Copy Code code as follows:
Umask 077 #???????????????
Tmpfile=${tmpdir-/tmp}/myprog. "/>you can ' t
Often, when people refer to the "Shell scripting language", they are bash,ksh,sh or other similar Linux/unix scripting languages emerging in their minds. Scripting languages are another way to communicate with a computer. Users can move the mouse and click on a variety of objects, such as buttons, lists, marquee, and s
Use PHP as the Shell scripting language, read the use of PHP as the Shell scripting language, -- English original: DarrellBrogdon, published in http://www.phpbuilder.com/columns/darrell20000319.php3) many may have thought about using PHP to write some program such as timed sending, but it is impossible to execute
Darre
Use PHP as the Shell scripting language. We all know that PHP is a very good dynamic web page development language (fast speed, short development cycle ......). However, only a few people realize that PHP can also be well written. we all know that PHP is a very good dynamic web page development language (fast speed, short development cycle ......). However, only a few people realize that PHP can also be a g
As we all know, PHP is a very good dynamic web development language (fast, short development cycle ...). )。 But only a very small number of people realize that PHP can also be very good as the language of writing shell scripts, when PHP as the language of writing shell scripts, he is not as powerful as Perl or bash, but he has a good advantage, Especially for those of me who are familiar with PHP but are no
How to use PHP as the Shell scripting language
Probably a lot of people have thought of using PHP to write some timing letters and other programs, but there is no way to execute PHP on a regular basis;As we all know, PHP is a very good dynamic web development language (fast, short development cycle ...). )。 But only a very small number of people realize that PHP can also be very good as the language of wr
How to use PHP as the Shell scripting language
Probably a lot of people have thought of using PHP to write some timing letters and other programs, but there is no way to execute PHP on a regular basis;As we all know, PHP is a very good dynamic web development language (fast, short development cycle ...). )。 But only a very small number of people realize that PHP can also be very good as the language of wr
, in the shell script of the usual term loop.At this point, you press CTRL +z to pause it, and then enter BG to go back into the background.In the case of multitasking, if you want to move the task to the foreground, FG is followed by the task number and the task number can be obtained using the jobs command.9. >>, 2>, 2>> : The above-mentioned directional symbols > and >> denote the meaning of substitution and addition, then there are two symbols whi
to customize their command aliases and private script functions3. non-interactive shellThis is the shell used by the system to execute shell scripts.There is no command line prompt.Bash shell provides bash_env environment variables. When a non-interactive shell is started, bash_env is checked to see the startup file t
As we all know, PHP is a very good dynamic web development language (fast, short development cycle ...). )。 But only a very small number of people realize that PHP can also be very good as the language of writing shell scripts, when PHP as the language of writing shell scripts, he is not as powerful as Perl or bash, but he has a good advantage, Especially for those of me who are familiar with PHP but are no
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.