Help needed desperately......


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed desperately......
# 1  
Old 08-22-2008
Error Help needed desperately......

Hi guys,

I want to execute an SQL script based on a condition.... I am writing a sample requirement...

num = {some value}

if(num == 0)
then
cat>> test.sql <<FIN
select * from table_a
FIN
else
cat>> test.sql << FIN
select * from table_b
FIN
fi


This is what i wish to implement... I have implemented this in my code but seems to give and error in this part "<<FIN" (unmatched << found)...

Running the code only with the script that is without the conditional if statement no error is generated...

Has anyone encountered anything like this... plz suggest something... its very urgent for me.. kindly help....
# 2  
Old 08-22-2008
Code:
num=0

if [ $num -eq 0 ]
then
echo "Num 0"
else
echo "Num NOT 0"
fi


Last edited by Ikon; 08-22-2008 at 04:27 PM.. Reason: FIXED
# 3  
Old 08-22-2008
hi ikon,,

i have already tried that format of if still it is giving that error that i jst mentioned... any other suggestion??
# 4  
Old 08-22-2008
The one I posted is NOT like the one you posted..

you were missing "$" and you have to watch spaces between commands and vars.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed on If Else

Hi, I am using "nc" command to test connectivity to Application ports. I am getting following outputs in case of success & failed scenarios & I am re-directing it to a file. FLPROVP02 4848 (?) open FLPROVP02 4849 (?) : Connection refused My script is as below. #!/bin/bash cd... (2 Replies)
Discussion started by: SunilB2011
2 Replies

2. Shell Programming and Scripting

Expect Scripting Loop Argument Desperately Needed!

I am trying to create an Expect script that does the following: 1) Telnets to an IP address and logs in with user ID and Password 2) Issue a CLI command to the server that will output data of which I am particularly interested in a DS1 clock 'Slips' value. I want to be able to keep issuing... (0 Replies)
Discussion started by: dwightlaidler
0 Replies

3. UNIX for Dummies Questions & Answers

UNIX advice needed desperately :/

Firstly I do need to state that I am turning here as a last resort. Im in my first year of a Computer Networking and technical support course, and as a first year I must complete a Introductory Unix/Linux class. I have been doing well in the course so far however I have been stumped on the final... (1 Reply)
Discussion started by: setaylor5
1 Replies

4. Shell Programming and Scripting

Help Needed

please reply for this https://www.unix.com/shell-programming-scripting/111493-cutting-lines.html its really urgent (1 Reply)
Discussion started by: jojo123
1 Replies

5. Shell Programming and Scripting

Help needed desperately

Hello Folks, i have written a script to nullify the log files in my dev environment but the log files are not getting nullified.Please find below my script and also thank you all in advance for your help. find /app -size +100000 -xdev -exec du -k {} \; 2>/dev/null | sort -nr |ls -1dF ... (2 Replies)
Discussion started by: Rayzone
2 Replies

6. Shell Programming and Scripting

help needed...

Guys, There is a file where there are 1000s of records. In the file if some condition satisfies in a certain TAB record (TAB would be first 3 digits of a certain record) then move TAB and all the records (or lines) after TAB to new_file, until another TAB record is encountered in the same... (1 Reply)
Discussion started by: Prat007
1 Replies

7. UNIX for Dummies Questions & Answers

Help needed please.

i've been given an assignment to Write a system utility called recycle that satisfies the following requirements as they might be displayed in a UNIX/Linux man page: NAME recycle - stores files in a recycle bin SYNOPSIS recycle ... DESCRIPTION Recycle is a replacement for the... (3 Replies)
Discussion started by: jerryboy78
3 Replies

8. Shell Programming and Scripting

help needed

aaabbbcccd (1 Reply)
Discussion started by: hateshellscript
1 Replies

9. Shell Programming and Scripting

Help needed

Hi, I am beginner writing shell script i am using korn shell. I wrote shell script through which i am passing system date as parameter to build.xml file but i need to write a function when i pass systemdate as parameter the function has to return its respective quarterly date . Can any one... (0 Replies)
Discussion started by: connectpramod
0 Replies

10. Shell Programming and Scripting

Desperately Need Help On This Perl script

ok, i dont know any perl. actually, very very little. not much at all. now, the task i have is that i have to go into a directory that is packed with hundreds of files that contains lots of strings of which i have to filter through. so when i get into this directory, i type: grep -r akamai... (19 Replies)
Discussion started by: Terrible
19 Replies
Login or Register to Ask a Question