{"id":2231,"date":"2017-12-08T05:21:22","date_gmt":"2017-12-08T05:21:22","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2231"},"modified":"2020-01-09T09:50:07","modified_gmt":"2020-01-09T09:50:07","slug":"how-to-find-success-failure-status-of-a-command-in-different-shells","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-find-success-failure-status-of-a-command-in-different-shells\/","title":{"rendered":"How to find success\/failure status of a command in different shells?"},"content":{"rendered":"<p><strong>rajeshkumar created the topic: How to find success\/failure status of a command in different shells?<\/strong><\/p>\n<p>Ksh\/Borne\/Bash shell<br \/>\n$ ls \/usr\/bin<br \/>\n\u2026.<br \/>\n# when success value is 0<br \/>\n$ echo $?<br \/>\n0<br \/>\n$ ls \/usr\/bin\/blah<br \/>\nls: 0653-341 The file \/usr\/bin\/blah does not exist<br \/>\n# when failure non-zero status<br \/>\n$ echo $?<br \/>\n1<\/p>\n<p>c\/Tcsh<br \/>\n$ ls \/usr\/bin<br \/>\n\u2026.<br \/>\n# when success value is 0<br \/>\n$ echo $status<br \/>\n0<br \/>\n$ ls \/usr\/bin\/blah<br \/>\nls: 0653-341 The file \/usr\/bin\/blah does not exist<br \/>\n# when failure non-zero status<br \/>\n$ echo $status<br \/>\n1<\/p>\n<p>Regards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rajeshkumar created the topic: How to find success\/failure status of a command in different shells? Ksh\/Borne\/Bash shell $ ls \/usr\/bin \u2026. # when success value is 0 $ echo $?&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[454],"tags":[333],"class_list":["post-2231","post","type-post","status-publish","format-standard","hentry","category-shell-script","tag-command"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2231"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2231\/revisions"}],"predecessor-version":[{"id":2232,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2231\/revisions\/2232"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}