
{"id":5898,"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-2","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2009\/11\/29\/true-and-false-2\/","title":{"rendered":"true and false"},"content":{"rendered":"<h4><u> A UNIX Command <\/u><\/h4>\n<pre>\n$true\n$echo $?\n0\n$false\n$echo $?\n1\n$\n\n<\/pre>\n<h4><u> UNIX Explanation <\/u> <\/h4>\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<h4><u> Related Source Code Exposition<\/u><\/h4>\n<p><code><br \/>\nint<br \/>\nmain (int argc, char **argv)<br \/>\n{<\/p>\n<p>  if (argc == 2)<br \/>\n    {<br \/>\n      initialize_main (&amp;argc, &amp;argv);<br \/>\n      set_program_name (argv[0]);<br \/>\n      setlocale (LC_ALL, \"\");<br \/>\n      bindtextdomain (PACKAGE, LOCALEDIR);<br \/>\n      textdomain (PACKAGE);<\/p>\n<p>      atexit (close_stdout);<\/p>\n<p>      if (STREQ (argv[1], \"--help\"))<br \/>\n        usage (EXIT_STATUS);<\/p>\n<p>      if (STREQ (argv[1], \"--version\"))<br \/>\n        version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,<br \/>\n                     (char *) NULL);<br \/>\n    }<\/p>\n<p>  exit (EXIT_STATUS);<br \/>\n}<br \/>\n <\/code><\/p>\n<h4><u>Source Code Highlight<\/u><\/h4>\n<p>Recognize &#8211;help or &#8211;version only if it&#8217;s the only<br \/>\ncommand-line argument.<\/p>\n<h4><u> Featured Image <\/u><\/h4>\n<p><a href=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2011\/03\/31364-trueandfalse-2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2011\/03\/31364-trueandfalse-2.png\" alt=\"\" title=\"trueandfalse\" width=\"406\" height=\"226\" class=\"alignnone size-full wp-image-4936\" \/><\/a><\/p>\n<h4><u> Related Knowledge <\/u><\/h4>\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>\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<\/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","protected":false},"excerpt":{"rendered":"<p>A UNIX Command $true $echo $? 0 $false $echo $? 1 $ UNIX 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 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2009\/11\/29\/true-and-false-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;true and false&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":-1,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[153,73,83],"tags":[460],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5898"}],"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=5898"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5898\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=5898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=5898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=5898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}