ex-11-02_while.sh

来自「Berkely的学生写的」· Shell 代码 · 共 27 行

SH
27
字号
#!/bin/sh# Chapter 11 - The while loop# This example demonstrates the use of nested while loops# You may need to change the line:##    /bin/echo "$y \c" ## to##    /bin/echo -n "$y "## on your machine in order to get the same output as shown# in the bookx=0while [ "$x" -lt 10 ] ; # this is loop1do    y="$x"    while [ "$y" -ge 0 ] ; # this is loop2    do        /bin/echo "$y \c"        y=`echo "$y - 1" | bc`    done    echo    x=`echo "$x + 1" | bc`done

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?