Addition/Multiplication table generator Given a number and either "+" or "*", return an addition or multiplication table with the dimensions of that number.

Specifications


The input will be formatted as dimension, operation.
The program should not return anything if the operation input is not + or *.
The program should not return anything if the dimension input is less than 1.  




(4,*):
1 2 3 4
2 4 6 8
3 6 9 12
4 8 1216


(4,+):
1234
2456
3567
4678


The spaces between the numbers in the table should be equal to one less than the number of digits in dimension^2 for multiplication, and for addition one less than the number of digits in dimension * 2.
Bash + BSD Utils, 62 bytes

l=$[$1*$1-1]
eval echo \$[{1..$1}$2{1..$1}]|rs -g${#l} $[$1+1]

This calculates the number of spaces as per &quot;number of digits in (dimension^2)-1&quot;, and not as shown in the example output, as currently written.
This answer is very similar to this one.
Works out-of-the-box on macOS.  rs may need to be installed on Linux systems:
sudo apt-get install rs