【发布时间】:2015-02-08 02:02:04
【问题描述】:
我是 C 编程新手。我正在尝试使用逻辑运算符编写一个简单的命令行解释器。它的工作原理是这样的:
command1 ; command2 || command3 && command4
if ; second command will be executed after first command
if || second command only be executed if first command failed
if && second command will only be executed if first one succeeded
例如:
echo one ; echo one || echo two && echo four
输出应如下所示:
一个
一个
四个
任何提示将不胜感激。
【问题讨论】:
-
显示你迄今为止尝试过的内容
标签: c bash gnu logical-operators