Listing 30. Example of a case statement in bash.
清单30. bash中的case语句示例。
Listing 7 extends this case statement to handle delayed_job roles.
清单7扩展了这个case语句,来处理delayed_job角色。
If the values of that column are not a time stamp you will have to do a CASE statement.
如果该列不是一个时间戳,你将不得不做一个值情况语句。
A case statement within bash lets you test for more than one condition or value and act accordingly.
bash中的case语句可以用来测试多个条件或值并相应地执行操作。
The case statement is another conditional statement that you can use in place of using an if statement.
case语句是另一种条件型语句,您可以用该语句来替代if 语句。
Listing 1 shows an example of an SQL procedure with a case statement with a simple-case-statement-when-clause.
清单1展示了一个SQL过程的示例,包含一个case语句和一个simple - case - statement - when - clause。
A case statement allows you to quickly build upon it as your script evolves and needs to perform different tasks.
当您的脚本变得比较复杂、并且需要执行不同的任务时,可以使用case语句迅速地进行构建。
So, each time this section of code is executed, the $TIME is checked to see if it matches the times of the case statement.
因此,每次执行这个代码段的时候,将检查 $TIME是否匹配case语句所指定的时间。
Then, it updates its Internet control block with the foreign IP address and port number and returns to the PRU_CONNECT case statement.
然后使用外来ip地址和端口号更新其Internet控制块,并返回到PRU_CONNECT示例语句。
For each option, the case statement then attempts to identify the option, using either the short or long format and setting a variable.
对于每个选项,case语句会尝试识别该选项——使用短格式或长格式并设置一个变量。
This case statement simply checks the second command-line argument, and performs the correct action, depending on its value. If we now type
这条 case 语句只是检查第二个命令行自变量,然后根据其值执行正确操作。
Although it isn't the optimal solution, multiple elif statements can be used to mimic the switch case statement present in some other languages.
尽管它不是最优的解决方案,但是多个elif语句可以用于模拟其他一些语言中的switchcase语句。
Consider the code above and realize that any enumerated value not specifically processed by a case statement is instead processed by the default statement.
研究以上代码可以看出,任何没有被case语句处理的枚举值都会被default语句处理。
The getopts command returns true if an option is found, so a common option processing paradigm uses a while loop with a case statement as in this example.
如果找到一个选项,则getopts命令返回true,因此常见的选项处理范例使用带case语句的while 循环,本例中就是如此。
To have just your public IP address returned and then use that IP address in a case statement in your scripts that need to change from one site to another.
返回公共ip地址,然后在需要修改的脚本中的case语句中使用这个IP地址。
For example, you can use it in combination with a case statement to choose the right aliases, as per the ps examples in the previous section, like Listing 10.
例如,可以按照前一部分中的ps示例,将该命令与case语句结合使用以选择正确的别名,如清单10所示。
Let's take advantage of that and set the discount while we are creating the table in the first place. The following use of a CASE statement will take care of that for us.
我们可利用这个优势,可在首次创建表时设置discount。
The prior section discussed the two submission elements and highlighted two statements in each submit definition that referenced the same tokens these case statement reference, teo and yah.
前面的部分讨论了两个submission元素并重点研究了每个submit定义中的两条语句,该语句引用了与case 语句引用的相同的标志,即teo 和 yah。
The case statement works like its counterparts in traditional programming languages: It compares its argument to each pattern in a list; when a match is found, the corresponding code executes.
case语句的工作方式与传统编程语言中的对应结构相似。它将其参数与列表中的每个模式比较;当找到匹配项时,则执行对应的代码。
"For whatever reason, they were still hanging out on the Antarctic continent," Case said in a statement.
“无论是什么原因,它们确实一直在南极大陆上生活,”凯斯在一份声明中说。
Jumping into a statement expression with goto or using a switch statement outside the statement expression with a case or default label inside the statement expression is not permitted.
不允许使用switch语句或是goto跳入到声明表达式中。
In the first case, the constraint specification is consistent; in the second case, no statement about consistency can be made.
在第一种情况下,约束规范是一致的,在第二种情况下,不能对一致性给出结论。
In this case, they can issue a SELECT statement to identify rows that qualify then DELETE those rows.
在这种情况下,他们可以发出一条select语句来识别符合条件的行,然后再DELETE那些行。
Unlike elapsed time, in case of a declare cursor statement the CPU time is the sum of open, all fetched and close.
与消耗时间不同,对于声明游标的语句,CPU时间是打开游标、所有读取操作和关闭游标的时间总和。
Holding the mouse pointer over a syntax error like this brings up a hover tip describing the problem; in this case, it indicates that it is an incomplete statement requiring a semicolon.
将鼠标指针放在出现语法错误(比如这里的语法错误)的地方,一会将出现一个描述问题的快捷提示;在本例中,它指出语句不完整,还需要一个分号。
Each use case is represented by an oval, and labeled with a declarative statement that describes what action the use case is intended to perform.
每个用例都由一个椭圆形代表,用描述这个用例将要执行什么样的行为的说明型陈述进行标注。
Optimistic transaction locking should not be used to update sets of rows in a single update statement, as error handling in this case is very difficult.
乐观事务锁不能用于在单个update语句中更新数据行集合,因此在这种情况下,很难进行错误处理。
Optimistic transaction locking should not be used to update sets of rows in a single update statement, as error handling in this case is very difficult.
乐观事务锁不能用于在单个update语句中更新数据行集合,因此在这种情况下,很难进行错误处理。
应用推荐