#!/bin/bash
# c style
for((i=1;i<=10;i++));
do
echo $(expr $i \* 3 + 1);
done
# shell style
for i in $(seq 1 10)
do
echo $(expr $i \* 3 + 1);
done
# math style
for i in {1..10}
do
echo $(expr $i \* 3 + 1);
done
# basic style
awk 'BEGIN{for(i=1; i<=10; i++) print i}'
# string loop
for i in `ls`;
do
echo $i is file name;
done
for i in $* ;
do
echo $i is input chart;
done
for i in f1 f2 f3 ;
do
echo $i is appoint;
done
list="rootfs usr data data2"
for i in $list;
do
echo $i is appoint;
done
# path loop
for file in /proc/*;
do
echo $file is file path;
done
for file in $(ls *.sh)
do
echo $file is file path;
done
网友评论