Thread: is error_exit a valid command?

  1. #1
    Dragon Rider jas_atwal's Avatar
    Join Date
    Nov 2007
    Location
    India
    Posts
    54

    is error_exit a valid command?

    Hi guys,

    I wrote the following code:
    Code:
    #!/bin/sh
    
    echo this is simply to demonstrate the use of error_exit
    error_exit i am exiting..
    echo this won't be displayed
    I execute this and get the following:
    Code:
    this is simply to demonstrate the use of error_exit
    ./errorHandle.sh: line 4: error_exit: command not found
    this won't be displayed

    I am sure error_exit is a valid command. isn't it?
    -------------------------------------------------------------------
    There are 10 kinds of people in this world....Those who understand binary and those who don't

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Not that I've heard of. "exit -1" might do what you want.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    Ya thats right, even i had been playing around with some shell script to configure my startup applications on bootup. Well it should either exit 0 or exit 1.

    Since you wanted to exit with an error use "exit 1"

    SSHarish

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by jas_atwal View Post
    I am sure error_exit is a valid command. isn't it?
    It is not. But you could create one easily.

    Code:
    error_exit()
    {
        exit 1
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. system command not executing with format specifier
    By ridhamshah in forum C Programming
    Replies: 6
    Last Post: 11-08-2006, 05:58 AM
  2. how to run an exe command in c++ and get back the results?
    By mitilkhatoon in forum C++ Programming
    Replies: 5
    Last Post: 09-21-2006, 06:00 PM
  3. Replies: 30
    Last Post: 09-12-2006, 07:06 PM
  4. problem with "touch" command in c program
    By Moony in forum C Programming
    Replies: 10
    Last Post: 08-01-2006, 09:56 AM
  5. Command Interface : Black Box testing
    By GlowinCelica in forum C Programming
    Replies: 1
    Last Post: 03-10-2003, 10:21 PM