One, wait () functionWhen you call the Wait () function in a process(1) If all of its subroutines are still being executed, the blockage(2) Assume that a child process has been terminated. Waits for the parent process to get its terminating state.(3) If there are no child processes, an error is returned.In the following instance. Call Wait () in the parent
One, wait () functionWhen you call the Wait () function in a process(1) If all of its subroutines are still running, block(2) If a child process is terminated, wait for the parent process to get its terminating state.(3) If there are no child processes, an error is returned.In the following instance, wait () is called in the parent
-*-import getpassname=raw_input(‘请输入用户名:‘)pwd=getpass.getpass(‘请输入密码:‘)ifname=="alex"andpwd=="cmd":print("欢迎,alex!")else:print("用户名和密码错误")Scenario two, Guess age gameSet your age in the program, and then start the program to let the user guess, after the user input, according to his input prompts the user to enter the correct, if the error, the hint is guessed big or small#!/usr/bin/env python#-*-coding:utf-8-*-My_age= 28User_input= Int (Input ("input your guess num:")) ifUser_input = =My_age:P
[Article Author: Zhang Yi This version: v1.0 last modified: 2007.11.16 reprint Please specify the Source: http://blog.s135.com]Recently encountered a problem, Linux under the PHP command-line program as a daemon, the need to read from the queue file a row of data, through the TCP protocol sent to the field of the receiving server, read the next line of data, and then sent. When local and foreign network conditions are bad, sometimes it takes a long time to send a piece of data, which accumulates
1. Introduction
We now turn to the process control provided by the UNIX System. This includes the creation for new processes, program execution, and process termination. We also look at the various IDs that is the property of the Process-real, effective, and saved; User and group Ids-and how they ' re affected
Process Control statements 1. Sequential statements:Statement: A semicolon-delimited code is used as a statement.Note: There is no code, only one semicolon is also a statement.Sequential statements are statements executed sequentially in order from top to bottom2. If Judgment statementThe IF statement is divided into three syntax formats, each of which has the characteristics of each format.If there is only
Label:Process Control Statements:
BEGIN ... END
WAITFOR
Goto
While
IF ... ELSE
Break
RETURN
Continure
1.BEGIN ... END BEGIN ... The end statement is used to combine multiple Transact-SQL statements into a single logical block. When a Process Control statement must execute a
letters in the class name are capitalized, so that the package name and the class name can be distinguished clearly when referencing.
by statically introducing a package, you can directly reference a static member method or static member variable of a class. For example, an import static Java.lang.Math.PI uses the import statics of the class to be used in the passive resource, then the PI instead of the Math.PI can be used directly in the next code. In addition, you can represent all static
I. Process Control 1. Sequential structure* Default process structure, execute each statement in writing order2. Select structure* To judge a given condition and then determine the execution of the code based on the result of the judgment.3. Cyclic structure* Repeated execution of a piece of code in the case of a given conditionIi. choice of structure--if1. How t
$} ';--d2= ' echo ' $YEAR $MONTH $DAY "|awk" {if (length ($) ==1) $2=0$2;if (Length ($) ==1) $3=0$3;printf "%s%s%s", $1,$2,$3} "--day= ' Echo ' cal $MONTH $YEAR \ ' |tail-n1|awk ' {print $NF} 'Command:Find. -mtime-1-type F-printUsed to find files that have been modified in the last 24 hours (-mtime–2 represents the last 48 hours). If you want to hit a package with all the files you find, you can use the following script:#!/bin/sh# The Ticks is Backticks (') not normal quotes ('):TAR-ZCVF lastmo
Speaking of Process Control, in fact, if you learn other languages, then learn these will feel very simple, because the principle is the same, but the syntax has changed. So as a programmer must be in-depth understanding of a language, learning a lot of language, but not proficient in some of the words, is equal to not learning, can only say that you know a little more.Basic
/python_zm/test-01.py1*1=11*2=22*2=41*3=32*3=63*3=91*4=42*4=83 *4=124*4=161*5=52*5=103*5=154*5=205*5=251*6=62*6=123*6= 184*6=245*6=306*6=361*7=72*7=143*7=214*7=285*7=356*7=42 7*7=491*8=82*8=163*8=244*8=325*8=406*8=487*8=568*8=64 1*9=92*9=183*9=274*9=365*9=456*9=547*9=638*9=729*9=81 2.4. Break and ContinueAll two of the following are loop-terminated statementsIf, for some reason, you do not want to continue looping in the process of looping, you will
Like most design languages, Java uses loop statements and conditional statements to control the flow.Loop statement:
While
Do-while
For, for each
The For Each loop defines a variable that holds each element in the collection and executes the corresponding statement. This is more concise and less error-prone (ignoring array subscripts). Example: for (int element:a)SYSTEM.OUT.PRINTLN (Element);Conditional statements:
If
Preface today just wrote an automated packaging script, again using the bash shell, a good feeling of happiness. The main point here is to introduce the Select command, which can help us to complete the menu selection function.Format I am also the first to use Select Process Control, in PHP, Java, C these languages do not implement the Select function. In the Bash shell, the Select format is as follows:Sele
4.1.3 Shell Process Control Statements If condition judgment StatementIf ( expression ) #if (Variable in Array)Statement 1ElseStatement 2FiCase one, test if the directory exists, does not exist then new (note that space must be between the brackets)#!/bin/sh#judge direxistif [! -d/data/20140515];thenmkdir-p/data/20140515Elseecho "This DIR isexist,please exit ..."FiLogical operator parsing:- F determine if
Process Control for Java:1. Sequential structure2. Select structureA, relational operations, logical operations, conditional operationsB, if statementC, if-else statement, If-else If-else statementd, switch statements,3. Circular statementsA, while statementB, Do-while statementC, for loop general for loop with enhanced for loopD, loop nesting4. Jump StatementA, break statementB, continue statementPractice:
Declare mycursor Cursor FORSelect * FROM table1Open MyCursorFetch next from MyCursor to @ variableWhile @ @FETCH_STATUS =0Begin--processing a single recordFetch Next from MyCursorEndClose MyCursorDeallocate mycursor Third, Process Control statement (if Else | Select Case | while) Select ... Case Instance DECLARE @iRet INT, @PKDisp VARCHAR SET @iRet = ' 1 ' nbsp; Select @iRet = case when @PKDis
Tags: Strong style local syntax HTTP command size Process Control colorFirst, ifSyntax format: If test-d $arg then ... else ... fiVariable test statements can be simplified with []. Example: test-d $arg equivalent to [-D $arg]. (Note: "Space" ["Space"-D "space"])For more test commands see: http://www.cnblogs.com/fangwu/p/8422910.html1. Sample script code#!/bin/shif [-D $arg]then echo "This is a folder" E
Process exitThe process end indicates that the process is about to end, and the process exit methods in the Linux system are divided into normal exit and exception exit.Exit functionThe process has three normal termination methods and two kinds of abnormal termination method
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.