5

Grab SQL Running in a Shell Script

 2 years ago
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

advertisements

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

I want to run a shell script from my program below but it doesn't seem to do anything. I've run the same command directly in the linux terminal and it works fine so I'm guessing it's my java code. As you can see, I was first writing the command to th

how to run sql queries from a shell script

I am writing a shell script to run bunch of queries in postgres. This is the script that I have written. #!/bin/sh host="172.16.7.102" username="priyank" dbname="truaxis" x=1 echo "Connection done" while [ $x -le 3

How to complete a long-term SQL query in a shell script by using SQL_ATTR_QUERY_TIMEOUT

How do I terminate a long running SQL query in shell script using SQL_ATTR_QUERY_TIMEOUT?Query timeout for ODBC/CLI applications, including the DB2 CLP (which I assume you mean by "shell script"), can be set using the QueryTimeout parameter in d

Run a php shell script

I have a shell script which works perfectly if I run it in the terminal (MAC OSX) #!/bin/bash cd /Applications/XAMPP/xamppfiles/htdocs/chemedit/ babel -imol 'a.mol' -oinchi 'outputfile.inchi' babel -imol 'a.mol' -osmi 'a.smsi' babel a.smi -O out.svg

Crontab Does Not Run a Function Shell Script

I have a script of the following format: #!/bin/bash cd /abc/def/user1/test export NIMBUS_ENV_FILE=/abc/def/user1/test/nimbus_env main/vdnet -c yaml/config.yaml -t ABC...* my script executes perfectly when run from the shell.I want to execute this sc

How to Enable Certain Commands While Running in a Shell Script

I have written 1 shell script to run Jstack command for a particular Process ID (PID). But some time it may happen that multiple PIDs are there in a server for Java process. At that case i want to run that many Jstack commands giving respective PIDs

How to Run a Bash Shell Script in Windows

Apreciate any help and excuse me if my terminology is incorrect. this is a script(*.sh file) that: 1-goes to a specific dir A 2-copies files from another dir B to dir A 3-#comented out# it also unzips the files in dir A and its subdirectories 4-#come

The cp command does not run if it is run from a shell script

i have very simple shell script #!/bin/bash cp -rf /var/www/ksite/app2/* /var/www/ksite/app echo "----" echo "done" but seems cp command fails if i execute cp -rf /var/www/ksite/app2/* /var/www/ksite/app from terminal everything work o

How to run a local shell script on remote servers?

I have a shell script in my local machine and I have to execute that shell script on remote servers. I have done some steps as follows: Paired SSH key from local machine and remote server; ssh user@hostname 'bash - s' < user_add.sh; I am getting an e

How to encode in java to run a Unix shell script that uses rSync internally in the Windows environment using cygwin?

I am using cygwin to get unix environment on windows. I have some shell script that run on cygwin to perform syncing works and other things. I want to executes these script through java code. Also during executing of scripts on cygwin , certain infor

Run a node shell script in --armarmony mode

How can I run a globally-installed node module that exposes a shell script in --harmony mode?TL;DR: Just use Node 5+, most ES6 features will be availble right away. 2016 answer This is more like an amendment to the 2015 answer. The reason is because

How to run a C shell script in Linux?

How can I execute a shell script from C in Linux?It depends on what you want to do with the script (or any other program you want to run). If you just want to run the script system is the easiest thing to do, but it does some other stuff too, includi

Run FFmpeg from Shell Script

I have found a useful shell script that shows all files in a directory recursively. Where it prints the file name echo "$i"; #Display File name. I would instead like to run an ffmpeg command on non MP3 files, how can I do this? I have very limit

Can I run a Linux shell script in Windows?

I created Shell Script on Linux and it runs fine. Now I want to run the same script on Windows using gitbash. (Only filepath changed for windows) I am confused: do I need to write a new shell script again according to Windows syntax shell script? or

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK