3つの関数があります。どのようにそれらを1つにマージするのですか? 私は関数3にテーブル名のリストを持っています。関数2はそのテーブルに対応するノード名を持ち、関数1は各テーブルの列数を持っています。 私は、3つの入力値すべてで1つの関数を優先し、関数入力によって渡される手がかりに応じて必要なものだけを使用します。3つの関数を1つにマージする
function_1()
{
while read tbl col_num
do
mysql test -e"call mysql.createtable('$tbl', $col_num);"
done << mytbl_list
test.authadv 45
test.fee 29
test.finadv 54
mytbl_list
}
# match tables names with the respective nodes
function_2()
{
while read tbl tag
do
php -e xmlread_new.php $filename $tbl $tag
done << heredc
test.authadv AUTHADV
test.fee FEE
test.finadv FINADV
heredc
}
# export data to excel. Change the table names as required
function_3()
{
while read tbl_name
do
mysql --table -e"select * from $tbl_name" > $report_name.txt
done << tbl_heredoc
test.authadv
test.fee
test.finadv
tbl_heredoc
}
、私は一度だけ書き込むことが可能であるならば3回「test.authadv」を書きたくはありません:) – shantanuo
誰か、誰が「doesnのことを前と**後**例を教えてくださいあなたの仕事は終日分かります;-) – shellter