?? for-loopc.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 + -