Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

zztabuada: melhorado alihamento, colocando zzzz -h no topo, removida …

…variável $linha2
  • Loading branch information...
commit 6cd42204257c2929ac447614acbb00bd9654b02d 1 parent 7b1e718
Aurelio Jargas aureliojargas authored
Showing with 17 additions and 19 deletions.
  1. +17 −19 zz/zztabuada
36 zz/zztabuada
View
@@ -15,12 +15,11 @@
# ----------------------------------------------------------------------------
zztabuada ()
{
- local linha="+--------------+--------------+--------------+"
- local linha2="+---------------+"
- local calcula
-
zzzz -h tabuada $1 && return
+ local i j calcula
+ local linha="+--------------+--------------+--------------+"
+
case "$1" in
[0-9] | [0-9][0-9])
for i in 0 1 2 3 4 5 6 7 8 9 10
@@ -31,25 +30,24 @@ zztabuada ()
*)
for i in $(zzseq 1 3 9)
do
- echo $linha
- echo "| Tabuada do $i | Tabuada do $(($i+1)) | Tabuada do $(($i+2)) |"
- echo $linha
- for j in `seq 0 10`
- do
- [ $j -lt 10 ] && echo -n "| $i x $j = " || echo -n "| $i x $j = "
- calcula=$(($i*$j))
- [ $calcula -lt 10 ] && echo -n "$calcula |" || echo -n "$calcula |"
- [ $j -lt 10 ] && echo -n " $(($i+1)) x $j = " || echo -n " $(($i+1)) x $j = "
- calcula=$((($i+1)*$j))
- [ $calcula -lt 10 ] && echo -n "$calcula |" || echo -n "$calcula |"
- [ $j -lt 10 ] && echo -n " $(($i+2)) x $j = " || echo -n " $(($i+2)) x $j = "
- calcula=$((($i+2)*$j))
- [ $calcula -lt 10 ] && echo "$calcula |" || echo "$calcula |"
+ echo $linha
+ echo "| Tabuada do $i | Tabuada do $(($i+1)) | Tabuada do $(($i+2)) |"
+ echo $linha
+ for j in `seq 0 10`
+ do
+ [ $j -lt 10 ] && echo -n "| $i x $j = " || echo -n "| $i x $j = "
+ calcula=$(($i*$j))
+ [ $calcula -lt 10 ] && echo -n "$calcula |" || echo -n "$calcula |"
+ [ $j -lt 10 ] && echo -n " $(($i+1)) x $j = " || echo -n " $(($i+1)) x $j = "
+ calcula=$((($i+1)*$j))
+ [ $calcula -lt 10 ] && echo -n "$calcula |" || echo -n "$calcula |"
+ [ $j -lt 10 ] && echo -n " $(($i+2)) x $j = " || echo -n " $(($i+2)) x $j = "
+ calcula=$((($i+2)*$j))
+ [ $calcula -lt 10 ] && echo "$calcula |" || echo "$calcula |"
done
echo $linha
echo
done
- return
;;
esac
}
Please sign in to comment.
Something went wrong with that request. Please try again.