
{"id":8557,"date":"2013-06-23T19:41:19","date_gmt":"2013-06-23T19:41:19","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?page_id=8557"},"modified":"2013-06-23T19:41:19","modified_gmt":"2013-06-23T19:41:19","slug":"true-and-false-notes","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2013\/06\/23\/true-and-false-notes\/","title":{"rendered":"true and false notes"},"content":{"rendered":"<table style=\"width:100%;\">\n<tr>\n<td>\n<h2><u> A UNIX Command <\/u><\/h2>\n<pre>\n$true\n$echo $?\n0\n$false\n$echo $?\n1\n$\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\n\n<\/pre>\n<\/td>\n<td>\n<h2><u>UNIX Explanation<\/u><\/h2>\n<pre>\ntrue - do nothing, successfully\nexit with a status code indicating success.\nfalse - do nothing, unsuccessfully\nexit with a status code indicating failure.\n<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<h2><u> Related Source Code Exposition<\/u><\/h2>\n<pre>\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 <\/pre>\n<\/td>\n<td>\n<h2><u>Source Code Highlight<\/u><\/h2>\n<pre>\nRecognize --help or --version only if it's the only\ncommand-line argument.\n<\/pre>\n<\/td>\n<\/tr>\n<tr style=\"float:left;\">\n<td>\n<h2><u> Featured Image <\/u><\/h2>\n<p><a href=\"http:\/\/www.beautifulwork.org\/wp-content\/uploads\/2009\/11\/trueandfalse.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.beautifulwork.org\/wp-content\/uploads\/2009\/11\/trueandfalse.png\" alt=\"\" title=\"trueandfalse\" width=\"406\" height=\"226\" class=\"alignnone size-full wp-image-4936\" \/><\/a>\n<\/td>\n<td>\n<h2><u> Related Knowledge <\/u><\/h2>\n<pre>\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\n<\/pre>\n<pre>\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<\/pre>\n<pre>\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.\n\n<\/pre>\n<p>source : info coreutils &#8216;true invocation&#8217;<\/p>\n<td>\n<\/tr>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>A UNIX Command $true $echo $? 0 $false $echo $? 1 $ $ .\/true &#8211;version &gt;&amp;- .\/true: write error: Bad file number $ .\/true &#8211;version &gt; \/dev\/full .\/true: write error: No space left on device UNIX Explanation true &#8211; do nothing, successfully exit with a status code indicating success. false &#8211; do nothing, unsuccessfully exit &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2013\/06\/23\/true-and-false-notes\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;true and false notes&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"page-templates\/full-width.php","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/8557"}],"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=8557"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/8557\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=8557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=8557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=8557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}