Miscellaneous improvements

This commit is contained in:
Crestwave
2019-01-19 17:20:13 +08:00
parent 2b558f2962
commit 2414ae9f42
9 changed files with 78 additions and 50 deletions

View File

@@ -41,12 +41,12 @@ arr=(apples oranges tomatoes)
# Elements and index.
for i in "${!arr[@]}"; do
printf '%s\n' "${arr[$i]}"
printf '%s\n' "${arr[i]}"
done
# Alternative method.
for ((i=0;i<${#arr[@]};i++)); do
printf '%s\n' "${arr[$i]}"
printf '%s\n' "${arr[i]}"
done
```