如何在csh的一行中编写If-else语句? [英] How to write If-else statement in one line in csh?

查看:2530
本文介绍了如何在csh的一行中编写If-else语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Cshell,并且在oneLine中编写if else语句。

I use Cshell and i'm writing an if else statement in oneLine.

如果语句成功执行,否则else块将进入无限循环,并且无法退出

If statement executed successfully and else block is going for infinite loop and cannot exit back to promt.

任何建议如何解决?

/home/sun_cdmasee>if ( 25 == 25 )  then ; echo "yes" ; else  echo "no" ; endif

其他吗?

其他吗?

其他吗?

推荐答案

手册页说不可能:


(单词 else endif 必须出现在输入行的开头; if 必须单独出现在其输入行或 else 之后。)

(The words else and endif must appear at the beginning of input lines; the if must appear alone on its input line or after an else.)

请勿尝试在csh中进行编程。甚至不要将其用作交互式shell。

Don't try to program in csh. Don't even use it as your interactive shell.

顺便说一句,您可以通过在 else处键入 endif 退出正常的csh提示符。 ?提示。

Incidentally, you can exit back to your normal csh prompt by typing endif at the else? prompt.

这篇关于如何在csh的一行中编写If-else语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆