@Great-Chinese
2016-08-10T01:37:15.000000Z
字数 532
阅读 944
linux练习
awk 'ORS=NR%3?" ":"\n"{print}' 1.txt
#!/bin/bash
sum=0
index=1
while [ $index -le $1 ]
do
sum=$[$sum+$index];
index=$[$index+1]
done
echo $sum
#!/bin/bash
if [ ! -n "$1" ]
then
echo "Please input a number" ;
exit 0
fi
result=`echo $1 | grep '^[0-9]*$'`
if [ -n "$result" ]
then
echo "$1 Is a Number"
else
echo "$1 Is Not Number"
fi
第一个数1
第二个数2
第三个数3
第四个数5
第五个数8
第六个数13
#!/bin/bash
a=1
b=2
i=3
while [ $i -le 50 ]
do
c=$[$a+$b]
a=$b;
b=$c;
i=$[$i+1];
echo "$a -> $b -> $c"
done
echo $c;
#!/bin/bash
for ((i=1;i<=9;i++))
do
for ((j=1;j<=$i;j++))
do
echo -n "$i*$j="$[$i*$j]" "
done
echo ""
done