MySQL Forums
Forum List  »  MySQL Shell

Passing parameters in js batch
Posted by: Claude J. Morin
Date: August 06, 2022 10:24AM


I'm testing MySQL Shell (ver. 8.0.30) using a JavaScript batch file which begin with:
#!/usr/bin/mysqlsh --file

After a shell.connect(), I'm running this test SQL:

session.runSql("SHOW Tables FROM DB");

It is working but the DB name is hardcoded in the script. I would like to pass the database name on the command line as a parameter, i.e. "./testBatch.js DBNAME". That way, I could use the same batch script with different databases. I can't seem to find the way to pass and use the parameter in the js script.

Any help would be greatly appreciated.

Thank you!


Options: ReplyQuote

Written By
Passing parameters in js batch
August 06, 2022 10:24AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.