EXIT from a Program not from the function..


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers EXIT from a Program not from the function..
# 8  
Old 09-05-2007
Question

Yes, Thanks for such a nice reply. But, thing is that this is not working along with HTML code. Where I need to include both HTML and nawk code.
The command exit (0) is existing from the nawk function, but it's executing the next line, i.e. "./exbin/mk_ht ./high/practice.ihtml".

Is it possible to use if condition along with the executable file inside an awk program ? For e.g.

if ( ($1 == "m_who") && ($4 == "External")) {
print "You don have access"
exit(0)
};
else{
system("./exbin/mk_ht ./high/practice.ihtml")
}


As it's in a HTML code, the SYSTEM call is also not working properly.
I want to avoid to do anymore operation after the error message. Please let me know if you have any clue regarding this.

Thanks,
Rohit..
# 9  
Old 09-06-2007
Quote:
Originally Posted by ronix007
Yes, Thanks for such a nice reply. But, thing is that this is not working along with HTML code. Where I need to include both HTML and nawk code.
The command exit (0) is existing from the nawk function, but it's executing the next line, i.e. "./exbin/mk_ht ./high/practice.ihtml".

Is it possible to use if condition along with the executable file inside an awk program ? For e.g.

if ( ($1 == "m_who") && ($4 == "External")) {
print "You don have access"
exit(0)
};
else{
system("./exbin/mk_ht ./high/practice.ihtml")
}


As it's in a HTML code, the SYSTEM call is also not working properly.

What does "not working properly" mean?
Quote:
I want to avoid to do anymore operation after the error message. Please let me know if you have any clue regarding this.

What HTML code are you talking about? You cannot execute awk scripts within HTML code (HTML is not a programming language), unless you are using SSI CGI scripts, in which case, where is awk getting its input?

# 10  
Old 09-06-2007
Well, sorry if there is any confusion..

This code is for front end, which is using HTML and java script. This is one of the program, which was using nawk and working fine. I have given the sample code also. I need to add one more condition as to exit the whole program once the error will prompt.

Once we get the error, it should come out of the program or stop there itself instead of coming ONLY out of that loop.

Hope it's clear enough now. The sample code is also posted in my earlier reply.

Thanks !!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies

2. Programming

exit function doubts

At many places in program I see exit() being called with 2 passed as parameter to it. exit(2); What does this 2 stands for? Can I get a list all such parameters to exit? (6 Replies)
Discussion started by: rupeshkp728
6 Replies

3. Shell Programming and Scripting

I dont want to exit the program by ctrl + c

Hey , guys I am new to shell programing ,, so need a help from you guys ... I have to write a shell script that accepts file name or directory name from the user if it is a directory then throw an error if it is a file then give the user two options . 1.overwrite the content 2.append the... (2 Replies)
Discussion started by: coolashu
2 Replies

4. Shell Programming and Scripting

Replacement of exit function

I am reading multiple numbers from user and getting its respective string value from the One.txt.But while putting this text value to the two.txt file , i want to check that if this string already there in the file , if the string already exists in the two.txt file .....the string will be ignored.... (1 Reply)
Discussion started by: jalpasoni
1 Replies

5. Shell Programming and Scripting

After exit from function it should not call other function

Below is my script that is function properly per my conditions but I am facing one problem here that is when one function fails then Iy should not check other functions but it calls the other function too So anyone can help me how could i achieve this? iNOUT i AM GIVING TO THE... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies

6. UNIX for Advanced & Expert Users

Cannot exit from a function?

Hi, Is there a way to exit from a subcommand, which is a function in my example below? #!/bin/ksh function exitFunction { if ]; then echo "success" elif ]; then echo "failed" exit 1 # the exit problem fi exit 0 } ... (2 Replies)
Discussion started by: chstr_14
2 Replies

7. Shell Programming and Scripting

Exit from function

Hi, I just want to exit from function if some condition doesnt meet then control should go back to main program and start running from where it left.. When i used "exit" inside the function, its simply exited from entire script and it didnt run anymore.. Any idea how to do this.. Thanks... (3 Replies)
Discussion started by: nram_krishna@ya
3 Replies

8. Shell Programming and Scripting

exit from function

Hi all, My kshell code is not working, when I use a function to return something. But when I use the same function as without returning any values, it is working. Pls help me here. Code1 : func1 () { y=`echo $x | grep XXX| cut -f 2 -d ' '` if ; then exit 100 ... (2 Replies)
Discussion started by: poova
2 Replies

9. Programming

capturing enter and exit of every function

If I have a "Hello World" function (just prints that) and a similar "Goodbye World" function... is there a way (maybe a compiler option?) that I can get them to be executed directly as the absolute first and last things run in every function call. So for example, the following code: int foo()... (5 Replies)
Discussion started by: jjinno
5 Replies

10. Programming

How to get exit value of an executable that gets called from function?

How to get exit value of an executable that gets called from function? I have an executable called “myexec” which returns 0 on success and different values for different fail scenarios. I need to call this (myexec) executable from “myprog()” function of other executable and get the exit value... (1 Reply)
Discussion started by: sureshreddi_ps
1 Replies
Login or Register to Ask a Question