#!/bin/sh
for1(){
for i in 1 2 3 4 5 6
do
echo "$i"
done
}
for1
#!/bin/sh
for2(){
for i in {1..10}
do
echo "$i"
done
}
for2
#!/bin/sh
for3(){
sum=0
#int=1
for i in {1..100..2}
do
let "sum+=i"
done
echo "sum is $sum"
}
for3
#!/bin/sh
for4(){
sum=0
for i in $(seq 1 2 100)
do
let "sum+=i"
done
echo "sum is $sum"
}
for4
#!/bin/sh
for5(){
for file in $(ls)
do
echo "file: $file"
done
}
for44(){
for file1 in $( ls )
do
echo "file: $file1"
done
}
#for5
echo "*****************"
for44
#!/bin/sh
echo "the number of arguments is $#"
for i in "$*"
do
echo "$i"
done
#!/bin/sh
for8(){
sum=0
for ((int=1;int<200;int++))
do
let "sum+=int"
done
echo "the sum is $sum"
}
for8
#!/bin/sh
for9(){
sum=1
for (( i=9;i>0;i-- ))
do
echo "$i"
let "sum*=i"
done
echo "the sum is $sum"
}
for9
时间: 2024-10-07 06:29:00