Skip to content

删除多余的英文原文,删除 for 的错误语法 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shuaitq
Copy link

@shuaitq shuaitq commented May 25, 2023

  1. 2.4. Functions 中有一段英文原文,应当删除,保留下面的中文翻译。
  2. 删除 for 的错误语法。

如 bash 文档所写

for 语句只有两种写法

for name [ [in [words …] ] ; ] do commands; done

for (( expr1 ; expr2 ; expr3 )) ; do commands ; done

如下 for 语句的写法是错的,应该被删除

for x := 1 to 10 do
begin
  statements
end

测试

Mac上测试

bash-3.2$ bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin22)
Copyright (C) 2007 Free Software Foundation, Inc.
bash-3.2$ cat test.sh 
#!/bin/bash

for x := 1 to 10 do
begin
  echo $x
end
bash-3.2$ ./test.sh 
./test.sh: line 3: syntax error near unexpected token `:='
./test.sh: line 3: `for x := 1 to 10 do'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant