Enviado em 13/12/2021 - 14:43h
Tarde pessoal, não entendo o motivo do meu shell não executar o mysql, eu passo o parametro da tabela que quero mas ele não traz nada..
#Parametro database
table_name=$1
if [ -z $1 ]; then
echo ""
echo "================================================================="
echo "Database Inform: lindex <table_name>"
echo "================================================================="
echo ""
fi
if [ -n $1 ]; then
$sql -e "SELECT DISTINCT
a.table_name as 'table',
b.table_rows,
ROUND(b.data_free / 1024, 2) AS 'data_free (KB)',
ROUND(((b.data_length + b.index_length) / 1024), 2) as 'Table_size (KB)',
ROUND(index_length / 1024, 2) as 'Index_size (KB)'
from information_schema.statistics as a
INNER JOIN information_schema.TABLES as b ON a.table_name = b.table_name GROUP BY 1,2;" 2>/dev/null
fi
#Parametro database
table_name=$1
if [ -z $1 ]; then
echo ""
echo "================================================================="
echo "Database Inform: lindex <table_name>"
echo "================================================================="
echo ""
fi
if [ -n $1 ]; then
$sql -e "SELECT DISTINCT
a.table_name as 'table',
b.table_rows,
ROUND(b.data_free / 1024, 2) AS 'data_free (KB)',
ROUND(((b.data_length + b.index_length) / 1024), 2) as 'Table_size (KB)',
ROUND(index_length / 1024, 2) as 'Index_size (KB)'
from information_schema.statistics as a
INNER JOIN information_schema.TABLES as b ON a.table_name = b.table_name GROUP BY 1,2;" 2>/dev/null
fi