We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
${array[@]}
#!/bin/bash my_array=("Hello World" "Goodbye World") # 错误的展开 for item in ${my_array[@]}; do echo $item done # 输出结果 Hello World Goodbye World
#!/bin/bash my_array=("Hello World" "Goodbye World") # 正确的展开 for item in "${my_array[@]}"; do echo "$item" done # 输出结果 Hello World Goodbye World
The text was updated successfully, but these errors were encountered:
No branches or pull requests
lint 解释
${array[@]}
)需要使用双引号,以确保每个元素被视为一个整体,特别是当元素中包含空格或其他特殊字符时。如果不使用双引号,Shell 可能会将元素错误地分割,从而导致不预期结果。错误用法
正确用法
The text was updated successfully, but these errors were encountered: