Afternoon Group of friends on a problem, the following posted figure:
Just for a while, the answers of the great gods began to gush out, and the following answers were posted:
1:for i in {111..999..111}
2:do
3:
4:for j in {1..9..1}
5:do
6:c= ' expr $i/$j '
7:
8:pd= ' echo $i $j $c '
9:sz= ' echo $pd | awk ' {print $, substr ($3,1,1)} '
10:v_1= ' echo $sz | awk ' {print $} '
11:v_2= ' echo $sz | awk ' {print $} '
12:
13:v_length= ' echo $c | awk ' {print length ($)} '
14:if [$v _length-eq 2];then
15:if [$v _1-eq $v _2];then
16:echo $i $j $c
17:fi
#echo $v _1 $v _2
19:fi
20:done
It's the first version of the shell.
Here's another shell version:
1: #!/bin/bash
2:for ((i=1;i<=9;i++));d o
3:for ((y=0;y<=9;y++));d o
4:a= $i $y
5:b= $i
6:c=$ (($a * $b))
7:
8:len= ' Expr length $c '
9:if [$len = "3"-a ' echo $c | cut-b 1 ' = ' echo $c | cut-b 2 '];then
10:if [' Echo $c | cut-b 2 ' = ' echo $c | cut-b 3 '];then
11:echo $a * $b = $c
12:
13:fi
14:fi
15:
16:done
17:done