logo
  • 教程列表
  • SO官方文档
  • 控制结构
    • if 语句
    • 循环数组
    • 使用 For 循环列表迭代数字
    • 条件执行命令列表
    • While 循环
    • 对于具有 C 风格语法的循环
    • 直到循环
    • 继续和休息
    • 循环中断
    • switch case 语句
    • For Loop 没有 list-of-words 参数
    • for 循环
  1. StackOverflow 文档
  2. Bash 教程
  3. 控制结构
  4. for 循环

for 循环

Created: November-22, 2018

#! /bin/bash

for i in 1 "test" 3; do #Each space separated statement is assigned to i
    echo $i
done

其他命令可以生成循环语句。请参阅“使用 For 循环迭代数字”示例。

这输出:

1
test
3
  • For Loop 没有 list-of-words 参数

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明