
{"id":18550,"date":"2009-11-29T11:17:46","date_gmt":"2009-11-29T11:17:46","guid":{"rendered":"http:\/\/froisa.com\/?p=79"},"modified":"2009-11-29T11:17:46","modified_gmt":"2009-11-29T11:17:46","slug":"true-and-false-3","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2009\/11\/29\/true-and-false-3\/","title":{"rendered":"true &#8211; do nothing, successfully. false  &#8211; do nothing, unsuccessfully"},"content":{"rendered":"<pre style=\"width:70%;\">\nGNU command\n\n$true\n$echo $?\n0\n$false\n$echo $?\n1\n$\nExplanation\n\ntrue - do nothing, successfully\nexit with a status code indicating success.\nfalse - do nothing, unsuccessfully\nexit with a status code indicating failure.\nRelated Source Code Exposition\n\nint\nmain (int argc, char **argv)\n{\n\n  if (argc == 2)\n    {\n      initialize_main (&amp;argc, &amp;argv);\n      set_program_name (argv[0]);\n      setlocale (LC_ALL, \"\");\n      bindtextdomain (PACKAGE, LOCALEDIR);\n      textdomain (PACKAGE);\n\n      atexit (close_stdout);\n\n      if (STREQ (argv[1], \"--help\"))\n        usage (EXIT_STATUS);\n\n      if (STREQ (argv[1], \"--version\"))\n        version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,\n                     (char *) NULL);\n    }\n\n  exit (EXIT_STATUS);\n}\n\nSource Code Highlight\nRecognize --help or --version only if it's the only\ncommand-line argument.\nFeatured Image\nFIXME\nRelated Knowledge\n\n`true' does  nothing except return  an exit status  of 0,\nmeaning \"success\".  It  can be used as a  place holder in\nshell  scripts  where  a  successful command  is  needed,\nalthough the  shell built-in  command `:' (colon)  may do\nthe same thing faster.   In most modern shells, `true' is\na built-in command,  so when you use `true'  in a script,\nyou're probably  using the built-in command,  not the one\ndocumented here.\n\nNote,  however, that it  is possible  to cause  `true' to\nexit   with  nonzero   status:  with   the   `--help'  or\n`--version'  option,  and  with standard  output  already\nclosed or redirected to a  file that evokes an I\/O error.\nFor example, using a Bourne-compatible shell:\n\n $ .\/true --version &gt;&amp;-\n     .\/true: write error: Bad file number\n     $ .\/true --version &gt; \/dev\/full\n     .\/true: write error: No space left on device\n\nThis version of `true' is implemented as a C program, and\nis  thus  more secure  and  faster  than  a shell  script\nimplementation, and  may safely be used as  a dummy shell\nfor the purpose of disabling accounts.\nsource : info coreutils 'true invocation'\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>GNU command $true $echo $? 0 $false $echo $? 1 $ Explanation true &#8211; do nothing, successfully exit with a status code indicating success. false &#8211; do nothing, unsuccessfully exit with a status code indicating failure. Related Source Code Exposition int main (int argc, char **argv) { if (argc == 2) { initialize_main (&amp;argc, &amp;argv); &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2009\/11\/29\/true-and-false-3\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;true &#8211; do nothing, successfully. false  &#8211; do nothing, unsuccessfully&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":4935,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/18550"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=18550"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/18550\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media\/4935"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=18550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=18550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=18550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}