csubloop.sh
来自「Shall高级编程」· Shell 代码 · 共 25 行
SH
25 行
#!/bin/bash# csubloop.sh: Setting a variable to the output of a loop.variable1=`for i in 1 2 3 4 5do echo -n "$i" # The 'echo' command is criticaldone` #+ to command substitution here.echo "variable1 = $variable1" # variable1 = 12345i=0variable2=`while [ "$i" -lt 10 ]do echo -n "$i" # Again, the necessary 'echo'. let "i += 1" # Increment.done`echo "variable2 = $variable2" # variable2 = 0123456789# Demonstrates that it's possible to embed a loop#+ within a variable declaration.exit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?