Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing a script from command line

Status
Not open for further replies.

schintapalli

Programmer
Nov 18, 2003
9
AU
In Informix, I want to execute some sql scripts from a Unix (Sun Solaris)shell program. The requirement is such that one sql should be executed on database1@server1 and another sql on database2@server2.
After executing these scripts I want to capture the output (both errors as well as any result set) to a file. PLease let me know how to handle this from a single shell program.
I was trying out with a simple shell script, like
dbaccess db1@srvr1 < p.sql 1>&2 2> source.log >>source.log
dbaccess db2@srvr2 <p.sql 1>&2 2>> source.log >> source.log

But I am not able to capture the out put fully. I am missing some info in the out put file. When I execute these individual commands from Unix prompt like
dbaccess db1@srvr1 < p.sql 1>&2 2> source.log >>source.log
I am able to capture the output including all error message. Please let me know how to handle this.
 
Hi,

The command may look similar to this:

dbaccess db1@srvr1 p.sql > source.log 2>&1
dbaccess db2@srvr2 p.sql >> source.log 2>&1

Regards,
Shriyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top