Sponsored Content
Top Forums Shell Programming and Scripting Need Help with isql in Shell Script Post 302624983 by gkrish on Tuesday 17th of April 2012 06:38:56 AM
Old 04-17-2012
Need Help with isql in Shell Script

Hi Guys,

I need help with my code.

I am not able to find what the error is (tried debugging and everything).

Code:
#! /bin/sh

# MODSET_CLOSE
# Usage: modset_close

echo "Enter the Type of Modsets that needs to be Closed: "
read mod_typ

serv_name=`cat $mod_typ | awk '{ print $1 }'`
usr_name=`cat $mod_typ | awk '{ print $2 }'`
pswd=`cat $mod_typ | awk '{ print $3 }'`
db_name=`cat $mod_typ | awk '{ print $4 }'`
unx_usr_name=`cat $mod_typ | awk '{ print $5 }'`

echo $serv_name
echo $usr_name
echo $pswd
echo $db_name
echo $unix_user_name

cnt_temp=1

while [ $cnt_temp -ne 0 ]
do
	echo "Enter the Modset that needs to be Closed: "
	read mod_id
echo $mod_id
        if [ $mod_id ]
	then
		isql -S $serv_name -U $usr_name -P $pswd  -D $db_name -o temp_res << EOF1
		select status from modset where modsetid=$mod_id
		go
		exit
		EOF1
echo 1
		stat_cnt=`cat temp_res.txt | grep -cw O`
echo $stat_cnt
		if [ stat_cnt -eq 1 ]
		then
			isql -S $serv_name -U $usr_name -P $pswd  -D $db_name  << EOF2
			select * into #updtmgr_session from tmp_updtmgr_session exec updtmgr_session NULL,$unix_user_name,"y","y"
			go
			exit
			EOF2
echo 2
			isql -S $serv_name -U $usr_name -P $pswd  -D $db_name  << EOF3
			modset_close_any $mod_id
			go
			exit
			EOF3
echo 3
			isql -S $serv_name -U $usr_name -P $pswd  -D $db_name -o out_res << EOF4
			select modsetid,comments from modset where modseid=$mod_id
			go
			exit
			EOF4
echo 4
		fi
	fi
echo 5
	cat out_res.txt | grep -wi "closed by" | echo
echo 6

done

I am getting the following error when run and i am not able to past the while loop ... i mean all the echo's are good till the while loop.

Code:
modset_close: syntax error at line 73: `end of file' unexpected


Please help ...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

isql in shell script help

Hello all... i'm trying to execute a shell script through crontab. To run at 8pm on wednesday's The crontab entry: 00 20 * * 3 /u2/dir1/dir2/jobs/p.sh the p.sh file: isql -s claims /u2/dir1/dir3/dir4/a.sql permissions for it are -rwxrwx--x i've confirmed a.sql is in that directory. ... (2 Replies)
Discussion started by: mrviking
2 Replies

2. Shell Programming and Scripting

isql query in unix shell script

Dear all I want to execute some isql command from unix shell script. Kindly suggest me. isql command mention below. isql -U -P use gdb_1 go select count (*) from table_x go (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

3. UNIX for Dummies Questions & Answers

Using isql in korn shell

Hi all, I have two accounts in a Unix server, the first one uses .tcsh as default shell and the other uses .ksh (korn shell) as default. When I login using the account with .tcsh default, I can use the isql command and connect to our database server. However, when I use the other... (2 Replies)
Discussion started by: risk_sly
2 Replies

4. Shell Programming and Scripting

ISQL Shell Script Question

I am trying to run the following Sybase SQL query in a shell script file. It isn't working although everything else in the file runs, and I can run queries from a file fine. For some reason, entering the query directly doesn't work. Any ideas? #!/bin/sh $SYBASE/$SYBASE_OCS/bin/isql -e... (2 Replies)
Discussion started by: andy_h
2 Replies

5. Shell Programming and Scripting

Passing Shell Variables in ISQL

Hi.. I am passing a variable in my shell function. I need to access it for an isql comand in the shell script. However the isql o/p gives no results if i pass a variable in the command. The isql command works perfectly fine if i hardcore the table name. My script is : ... (0 Replies)
Discussion started by: dikki
0 Replies

6. Shell Programming and Scripting

isql out in shell script

Hi I wrote a script for connecting isql(Sybase database) and stored the SQL output in Unix box. my script: isql -U${USER} -P${PASS} -S${SERVER} <<EOF > $WORK_DIR/out1.log go select convert(varchar(10),sdcurrent,101) from pr_sysdate go exit EOF Unfortunately, the output file not... (5 Replies)
Discussion started by: koti_rama
5 Replies

7. Shell Programming and Scripting

passing database password to isql command in shell script

Hi, I need to connect to DB through my shell script. but I dont want to hardcode my db password in the script. Is there a way to do it? Thanks ---------- Post updated at 07:42 PM ---------- Previous update was at 04:54 PM ---------- :(Guys..please help me with this:( (1 Reply)
Discussion started by: agrawal.prachi
1 Replies

8. UNIX for Dummies Questions & Answers

how to use shell variable in isql

Hi , I want to use shell variable in isql. example.. $ksh ./sudh.ksh "2041qwer" sudh.ksh is my script passing the perameter "2041qwer" Code in my script : =========== $SYBASE/$SYBASE_OCS/bin/isql -I$SYBASE/interfaces -S$OTHRSRVR -U$SYBUSER -P$SYBPASS -w... (1 Reply)
Discussion started by: sudhakarpasala
1 Replies

9. Shell Programming and Scripting

Help With isql in shell script

Hello I am not able to get the isql output to temp_res file ... i have tried all the different combinations as shown below, but could not get anywhere .... Please Help isql -S $serv_name -U $usr_name -P $pswd -D $db_name -o temp_res << EOF1 select status from modset where... (1 Reply)
Discussion started by: gkrish
1 Replies

10. Shell Programming and Scripting

Using Isql for SQL SERVER to get the table rows counts in UNIX shell script to

need to create shell script to read the table's name from file and connect SQL SERVER using isql (odbcunix) i 'm able connect to database with below command line syntex but i could not get working in shell script with SQL and storing the row count in variable. isql -v DSN USERNAME PASSWD ... (6 Replies)
Discussion started by: pimmit22043
6 Replies
AMANDA-SCRIPTS(7)						    Miscellanea 						 AMANDA-SCRIPTS(7)

NAME
amanda-scripts - Configuring and using the Script API DESCRIPTION
The Script API is a flexible system for invoking user-supplied scripts at various points in the execution of Amanda. This manual page describes the operation and configuration of the API. For help writing Script API scripts, see http://wiki.zmanda.com/index.php/Script_API. SCRIPTS
This section lists the scripts included with Amanda, see the individual man page for instructions on using them. For complete How-To information, consult the Amanda wiki at http://wiki.zmanda.com. o amzfs-snapshot(8), - create/destroy zfs snapshot. o script-email(8), - send email. Script properties work just like application properties: they are insensitive to case, and - (dash) and _ (underscore) may be used interchangeably. SCRIPTS OUTPUT PROPERTY
A pre-dle-amcheck, pre-dle-estimate or pre-dle-backup executed on the client can output property on stdout that are sent to the application. If the output line matches "PROPERTY str1 str2", Amanda sets a property called "str1" by the value of "str2", that property is sent to the application. SEE ALSO
amanda(8), amanda.conf(5) The Amanda Wiki: : http://wiki.zmanda.com/ AUTHORS
Jean-Louis Martineau <martineau@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Dustin J. Mitchell <dustin@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Amanda 3.3.1 02/21/2012 AMANDA-SCRIPTS(7)
All times are GMT -4. The time now is 06:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy