如何在csh的一行中编写If-else语句? [英] How to write If-else statement in one line in csh?
问题描述
我使用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
andendif
must appear at the beginning of input lines; theif
must appear alone on its input line or after anelse
.)
请勿尝试在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屋!