Results 1 to 4 of 4

Thread: What do true and false do

  1. #1
    Join Date
    Nov 2008
    Location
    /..
    Beans
    338

    What do true and false do

    I was looking at the programs true and false, and I know that true does nothing, but does it successfully, and false does nothing and does it unsuccessfully, but what does it matter?
    How do you find out if a program does anything successfully or not?
    Is it in the system logs or something?

  2. #2
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: What do true and false do

    true and false both do nothing and exit with a success and failure exit status respectively.

    See info true and info false.

    http://tldp.org/LDP/abs/html/exit-status.html
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  3. #3
    Join Date
    Nov 2005
    Location
    Sendai, Japan
    Beans
    11,296
    Distro
    Kubuntu

    Re: What do true and false do

    They are mostly used in shell scripts, when you're syntactically required to put a command but don't want any actual action to be done, or as a placeholder for a not-yet-implemented function.

    Also, you can define /bin/true or /bin/false as a user's default shell if you want to prevent that user from logging in on the system (since they're not actual shells and just do nothing, the user will be automatically sent back to the login prompt).
    Last edited by Bachstelze; March 25th, 2009 at 01:18 AM.
    「明後日の夕方には帰ってるからね。」


  4. #4
    Join Date
    Nov 2008
    Location
    /..
    Beans
    338

    Re: What do true and false do

    thx

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •