Sponsored Content
Full Discussion: Exit from function
Top Forums Shell Programming and Scripting Exit from function Post 302539138 by kshji on Friday 15th of July 2011 10:48:02 AM
Old 07-15-2011
Code:
Menu()
{
        stat=1
        while (( stat != 0 ))
        do
                echo -n "Enter a positive number:"
                read a
                Greater "$a"
                stat=$?
        done
}

Greater()
{
        num="$1"
        (( num > 0 )) && echo "$num is Positive number" && return 0
        echo "Entered number is not a positive"
        return 1
}

Menu

 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

exit shell script from function

Hi all, I have tried to put a exit 0 statement within a function I have created in the shell script but it doesn't seem to exit out of the script? Can someone tell me why? And is there any other way to exit out of the script from within a function? Thanks! (1 Reply)
Discussion started by: nvrh7
1 Replies

3. UNIX for Dummies Questions & Answers

EXIT from a Program not from the function..

Hi, I want a command in unix shell script which will exit my whole program, not only from the function it's using. For e.g: $1 == "m_who" && $4 == "Extrnl Vendor" { print "You don have access" exit (0); } If this error is showing on the screen, then nothing should not... (9 Replies)
Discussion started by: ronix007
9 Replies

4. 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

5. 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

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

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

8. 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

9. 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

10. 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
postdaisy(1)							   User Commands						      postdaisy(1)

NAME
postdaisy - PostScript translator for Diablo 630 daisy-wheel files SYNOPSIS
postdaisy [-c num] [-f num] [-h num] [-m num] [-n num] [-o list] [-p mode] [-r num] [-s num] [-v num ] [-x num] [-y num] [file...] /usr/lib/lp/postscript/postdaisy DESCRIPTION
The postdaisy filter translates Diablo 630 daisy-wheel files into PostScript and writes the results on the standard output. If no files are specified, or if - is one of the input files, the standard input is read. OPTIONS
-c num Print num copies of each page. By default only one copy is printed. -f name Print files using font name. Any PostScript font can be used, although the best results will be obtained only with constant-width fonts. The default font is Courier. -h num Set the initial horizontal motion index to num. Determines the character advance and the default point size, unless the -s option is used. The default is 12. -m num Magnify each logical page by the factor num. Pages are scaled uniformly about the origin, which is located near the upper left corner of each page. The default magnification is 1.0. -n num Print num logical pages on each piece of paper, where num can be any positive integer. By default, num is set to 1. -o list Print pages whose numbers are given in the comma-separated list. The list contains single numbers N and ranges N1 - N2. A missing N1 means the lowest numbered page, a missing N2 means the highest. The page range is an expression of logical pages rather than physical sheets of paper. For example, if you are printing two logical pages to a sheet, and you specified a range of 4, then two sheets of paper would print, containing four page layouts. If you specified a page range of 3-4, when requesting two logical pages to a sheet; then only page 3 and page 4 layouts would print, and they would appear on one physical sheet of paper. -p mode Print files in either portrait or landscape mode. Only the first character of mode is significant. The default mode is portrait. -r num Selects carriage return and line feed behavior. If num is 1, a line feed generates a carriage return. If num is 2, a carriage return generates a line feed. Setting num to 3 enables both modes. -s num Use point size num instead of the default value set by the initial horizontal motion index. -v num Set the initial vertical motion index to num. The default is 8. -x num Translate the origin num inches along the positive x axis. The default coordinate system has the origin fixed near the upper left corner of the page, with positive x to the right and positive y down the page. Positive num moves everything right. The default offset is 0.25 inches. -y num Translate the origin num inches along the positive y axis. Positive num moves text up the page. The default offset is -0.25 inches. EXIT STATUS
The following exit values are returned: 0 Successful completion. non-zero An error occurred. FILES
/usr/lib/lp/postscript/forms.ps /usr/lib/lp/postscript/ps.requests ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWpsf | +-----------------------------+-----------------------------+ SEE ALSO
download(1), dpost(1), postdmd(1), postio(1), postmd(1), postprint(1), postreverse(1), posttek(1), attributes(5) SunOS 5.10 9 Sep 1996 postdaisy(1)
All times are GMT -4. The time now is 10:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy