bash-guide icon indicating copy to clipboard operation
bash-guide copied to clipboard

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

Open shuaitq opened this issue 1 year ago • 0 comments

  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'

shuaitq avatar May 25 '23 15:05 shuaitq