ex53.sh

来自「Shall高级编程」· Shell 代码 · 共 54 行

SH
54
字号
#!/bin/bash# Using "seq"echofor a in `seq 80`  # or   for a in $( seq 80 )# Same as   for a in 1 2 3 4 5 ... 80   (saves much typing!).# May also use 'jot' (if present on system).do  echo -n "$a "done      # 1 2 3 4 5 ... 80# Example of using the output of a command to generate # the [list] in a "for" loop.echo; echoCOUNT=80  # Yes, 'seq' also accepts a replaceable parameter.for a in `seq $COUNT`  # or   for a in $( seq $COUNT )do  echo -n "$a "done      # 1 2 3 4 5 ... 80echo; echoBEGIN=75END=80for a in `seq $BEGIN $END`#  Giving "seq" two arguments starts the count at the first one,#+ and continues until it reaches the second.do  echo -n "$a "done      # 75 76 77 78 79 80echo; echoBEGIN=45INTERVAL=5END=80for a in `seq $BEGIN $INTERVAL $END`#  Giving "seq" three arguments starts the count at the first one,#+ uses the second for a step interval,#+ and continues until it reaches the third.do  echo -n "$a "done      # 45 50 55 60 65 70 75 80echo; echoexit 0

⌨️ 快捷键说明

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