Cygwin bash shell中的for循环后跟“". [英] For loop in Cygwin bash shell followed by ">"

查看:163
本文介绍了Cygwin bash shell中的for循环后跟“".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在cygwin bash shell中键入以下命令时:

When I type the following command in a cygwin bash shell:

for i in $(ls) do echo $i done

我得到一个>",要求我继续输入,而不是预期的行为.为什么?

I get a ">" asking me to keep typing, as opposed to the expected behavior. Why?

推荐答案

您需要将for,do和done语句分开.

You need to separate your for, do and done statements.. Try this:

for i in $(ls); do echo $i; done

您还可以使用换行符分隔语句.例如:

You can also separate the statements with newlines. For exmaple:

cygwin$ for i in $(ls)
> do
> echo $i
> done

这篇关于Cygwin bash shell中的for循环后跟“".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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