If you expected to see '2' you'll be disappointed. What if
you want BASH to evaluate some numbers you have? The solution
is this:
echo $((1+1))
This will produce a more 'logical' output. This is to evaluate an
arithmetic expression. You can achieve this also like this:
echo $[1+1]
If you need to use fractions, or more math or you just want it, you
can use bc to evaluate arithmetic expressions.
if i ran "echo $[3/4]" at the command prompt, it would return 0
because bash only uses integers when answering. If you ran
"echo 3/4|bc -l", it would properly return 0.75.
This little scripts show all tables from all databases (assuming you got MySQL installed).
Also, consider changing the 'mysql' command to use a valid username and password.
#!/bin/bash
DBS=`mysql -uroot -e"show databases"`
for b in $DBS ;
do
mysql -uroot -e"show tables from $b"
done