{"id":377,"date":"2012-06-26T11:14:21","date_gmt":"2012-06-26T18:14:21","guid":{"rendered":"http:\/\/www.robogourmet.com\/?p=377"},"modified":"2012-06-26T11:14:21","modified_gmt":"2012-06-26T18:14:21","slug":"bash-return-values","status":"publish","type":"post","link":"http:\/\/www.robogourmet.com\/?p=377","title":{"rendered":"Bash return values"},"content":{"rendered":"<p>Debugging a Bash script today and ran into this problem &#8211; return\/exit codes from functions may not exceed 255! My script backed up a subversion repository only when a new version of the repo existed, however, the function that checked the version had it&#8217;s output returned modulo 255, causing a problem.<\/p>\n<p>The solution was to return the data with echo, as suggested here:\u00a0<a href=\"http:\/\/tldp.org\/LDP\/abs\/html\/assortedtips.html#RVT\">http:\/\/tldp.org\/LDP\/abs\/html\/assortedtips.html#RVT<\/a><\/p>\n<p>Then the call<\/p>\n<pre>curVersion=`check_version ${SUBVERSION_REPOSITORY} ${SUBVERSION_REPOSITORY_NAME}`<\/pre>\n<p>assigns the result from the function check_version to curVersion.<\/p>\n<pre><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Debugging a Bash script today and ran into this problem &#8211; return\/exit codes from functions may not exceed 255! My script backed up a subversion repository only when a new version of the repo existed, however, the function that checked the version had it&#8217;s output returned modulo 255, causing a problem. The solution was to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,25],"tags":[],"class_list":{"0":"post-377","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-tech-tips","7":"category-technology"},"_links":{"self":[{"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=\/wp\/v2\/posts\/377"}],"collection":[{"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=377"}],"version-history":[{"count":2,"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=\/wp\/v2\/posts\/377\/revisions"}],"predecessor-version":[{"id":379,"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=\/wp\/v2\/posts\/377\/revisions\/379"}],"wp:attachment":[{"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=377"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.robogourmet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}