Let’s say I have a command:
mysql -h localhost -u root -pmypassword dev<file01.sql;
I have many sql files to run: file02.sql, file03.sql, … file99.sql
I want to generate a bash script like this to run all these sql files sequentially.
a portion of the bash script reads like this:
mysql -h localhost -u root -pmypassword dev<file01.sql;
mysql -h localhost -u root -pmypassword dev<file02.sql;
mysql -h localhost -u root -pmypassword dev<file03.sql;
mysql -h localhost -u root -pmypassword dev<file99.sql;
All these lines are of the same pattern, only file name (filexx.sql) changes.
All the filexx.sql are in the same directory.
I usually generate the bash script in Excel. I know this can be done in bash easily, I just do not know how. Could you advise on how to generate this?
Thank you very much.
If you want to execute those statements:
But if you only want to generate them: