How do you execute SQL from within a bash script?
I'm slightly confused. You should be able to call sqlplus from within the bash script. This may be what you were doing with your first statement
Try Executing the following within your bash script:
#!/bin/bash echo Start Executing SQL commandssqlplus <user>/<password> @file-with-sql-1.sqlsqlplus <user>/<password> @file-with-sql-2.sql
If you want to be able to pass data into your scripts you can do it via SQLPlus by passing arguments into the script:
Contents of file-with-sql-1.sql
select * from users where username='&1';
Then change the bash script to call sqlplus passing in the value
#!/bin/bashMY_USER=bobsqlplus <user>/<password> @file-with-sql-1.sql $MY_USER