Thread: Returning to Bash

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    115

    Question Returning to Bash

    Code:
    	printf( "Enter the number of gallons used, (-1 to end): " );
    	scanf( "%f", &gallons );
    	
    	if ( gallons == -1 )
    		printf( "No miles or gallons were entered\n" );
    	else if ( gallons != -1 )
    		printf( "Enter the number of miles driven: " );
    		scanf( "%f", &miles );
    i am having trouble ending these statements, when i enter -1 i want to return the message as stated but it end and return to the bash shell. What can i do? i tried adding return 0, break, etc.. it still wont work.
    I have a 'while' statement later on but this condition stated here is only when the user inputs no data at the very beginning.

    THANKS
    there are only 10 people in the world, those who know binary and those who dont

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    115

    Talking

    never mind
    i worked it out!!

    there are only 10 people in the world, those who know binary and those who dont

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-10-2009, 12:57 AM
  2. Recursion: base case returning 1, function returning 0
    By yougene in forum C Programming
    Replies: 5
    Last Post: 09-07-2007, 05:38 PM
  3. bash scripting?
    By Draco in forum Linux Programming
    Replies: 1
    Last Post: 01-08-2007, 06:15 AM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. redirecting standard error in Bash
    By wozza in forum Linux Programming
    Replies: 3
    Last Post: 07-16-2002, 04:55 AM