⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 for-loopc.sh

📁 Shall高级编程
💻 SH
字号:
#!/bin/bash# Two ways to count up to 10.echo# Standard syntax.for a in 1 2 3 4 5 6 7 8 9 10do  echo -n "$a "done  echo; echo# +==========================================+# Now, let's do the same, using C-like syntax.LIMIT=10for ((a=1; a <= LIMIT ; a++))  # Double parentheses, and "LIMIT" with no "$".do  echo -n "$a "done                           # A construct borrowed from 'ksh93'.echo; echo# +=========================================================================+# Let's use the C "comma operator" to increment two variables simultaneously.for ((a=1, b=1; a <= LIMIT ; a++, b++))  # The comma chains together operations.do  echo -n "$a-$b "doneecho; echoexit 0

⌨️ 快捷键说明

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