Grab SQL Running in a Shell Script
source link: https://www.codesd.com/item/grab-sql-running-in-a-shell-script.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Grab SQL Running in a Shell Script
Given a shell script containing a bunch of SQL statements, is there an option to redirect just the SQL statements to stdout/file?
The structure of the script is something like this:
for i in *list*
do
isql *credentials etc* <<EOF > a.out
select *about 100 cols*
from $i + "_TAB"
go
EOF
done
Query has been simplified, and is quite complex in reality.
How can I grab the actual statements that are executed when I run this script?
Much appreciate your help.
The -e (and often with -n) option will echo the input Sybase document for isql although you will get the output as well. If you want to not have the output - selects etc you will need to write a function called isql that will echo the command line to one file and run the isql to another (easier in perl or python)
Related Articles
Run a bash shell script in java
how to run sql queries from a shell script
How to complete a long-term SQL query in a shell script by using SQL_ATTR_QUERY_TIMEOUT
Run a php shell script
Crontab Does Not Run a Function Shell Script
How to Enable Certain Commands While Running in a Shell Script
How to Run a Bash Shell Script in Windows
The cp command does not run if it is run from a shell script
How to run a local shell script on remote servers?
How to encode in java to run a Unix shell script that uses rSync internally in the Windows environment using cygwin?
Run a node shell script in --armarmony mode
How to run a C shell script in Linux?
Run FFmpeg from Shell Script
Can I run a Linux shell script in Windows?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK