{"id":11,"date":"2021-12-30T15:06:51","date_gmt":"2021-12-30T15:06:51","guid":{"rendered":"https:\/\/223hosting.com\/?p=11"},"modified":"2021-12-30T15:06:52","modified_gmt":"2021-12-30T15:06:52","slug":"useful-bash-debugging-variables","status":"publish","type":"post","link":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/","title":{"rendered":"Useful BASH debugging variables"},"content":{"rendered":"\n<p>Bash variable ${LINENO} show the line number in the current script which useful when debugging scripts. Like: #!\/bin\/bash <br>echo .. foo<br>bar <br>echo &#8220;${LINENO}&#8221; # print 4<\/p>\n\n\n\n<p><br>Bash variables that I find useful for debugging are; <\/p>\n\n\n\n<p>${BASH_COMMAND} \u2192 Last command ran <\/p>\n\n\n\n<p>${BASH_LINENO[@]} \u2192 List line numbers up to that point<\/p>\n\n\n\n<p>${FUNKNAME[@]} \u2192 List functions in stack <\/p>\n\n\n\n<p>${BASH_SOURCE[@]} \u2192 List files in stack<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bash variable ${LINENO} show the line number in the current script which useful when debugging scripts. Like: #!\/bin\/bash echo .. foobar echo &#8220;${LINENO}&#8221; # print 4 Bash variables that I find useful for debugging are; ${BASH_COMMAND} \u2192 Last command ran ${BASH_LINENO[@]} \u2192 List line numbers up to that point ${FUNKNAME[@]} \u2192 List functions in stack [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Useful BASH debugging variables - 223 Hosting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Useful BASH debugging variables - 223 Hosting\" \/>\n<meta property=\"og:description\" content=\"Bash variable ${LINENO} show the line number in the current script which useful when debugging scripts. Like: #!\/bin\/bash echo .. foobar echo &#8220;${LINENO}&#8221; # print 4 Bash variables that I find useful for debugging are; ${BASH_COMMAND} \u2192 Last command ran ${BASH_LINENO[@]} \u2192 List line numbers up to that point ${FUNKNAME[@]} \u2192 List functions in stack [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/\" \/>\n<meta property=\"og:site_name\" content=\"223 Hosting\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-30T15:06:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-30T15:06:52+00:00\" \/>\n<meta name=\"author\" content=\"Andrew Armstrong\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andrew Armstrong\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/223hosting.com\\\/index.php\\\/2021\\\/12\\\/30\\\/useful-bash-debugging-variables\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/223hosting.com\\\/index.php\\\/2021\\\/12\\\/30\\\/useful-bash-debugging-variables\\\/\"},\"author\":{\"name\":\"Andrew Armstrong\",\"@id\":\"https:\\\/\\\/223hosting.com\\\/#\\\/schema\\\/person\\\/1ed0a0f9a442289133a9488824aa237f\"},\"headline\":\"Useful BASH debugging variables\",\"datePublished\":\"2021-12-30T15:06:51+00:00\",\"dateModified\":\"2021-12-30T15:06:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/223hosting.com\\\/index.php\\\/2021\\\/12\\\/30\\\/useful-bash-debugging-variables\\\/\"},\"wordCount\":62,\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/223hosting.com\\\/index.php\\\/2021\\\/12\\\/30\\\/useful-bash-debugging-variables\\\/\",\"url\":\"https:\\\/\\\/223hosting.com\\\/index.php\\\/2021\\\/12\\\/30\\\/useful-bash-debugging-variables\\\/\",\"name\":\"Useful BASH debugging variables - 223 Hosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/223hosting.com\\\/#website\"},\"datePublished\":\"2021-12-30T15:06:51+00:00\",\"dateModified\":\"2021-12-30T15:06:52+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/223hosting.com\\\/#\\\/schema\\\/person\\\/1ed0a0f9a442289133a9488824aa237f\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/223hosting.com\\\/index.php\\\/2021\\\/12\\\/30\\\/useful-bash-debugging-variables\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/223hosting.com\\\/index.php\\\/2021\\\/12\\\/30\\\/useful-bash-debugging-variables\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/223hosting.com\\\/index.php\\\/2021\\\/12\\\/30\\\/useful-bash-debugging-variables\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/223hosting.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Useful BASH debugging variables\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/223hosting.com\\\/#website\",\"url\":\"https:\\\/\\\/223hosting.com\\\/\",\"name\":\"223 Hosting\",\"description\":\"Tales from the digital world of a professional brewer\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/223hosting.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/223hosting.com\\\/#\\\/schema\\\/person\\\/1ed0a0f9a442289133a9488824aa237f\",\"name\":\"Andrew Armstrong\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1a05f43db0816ca80246e33d5afe56571c2e4bff6d3f98b8b5dbe404fc516df1?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1a05f43db0816ca80246e33d5afe56571c2e4bff6d3f98b8b5dbe404fc516df1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1a05f43db0816ca80246e33d5afe56571c2e4bff6d3f98b8b5dbe404fc516df1?s=96&d=mm&r=g\",\"caption\":\"Andrew Armstrong\"},\"url\":\"https:\\\/\\\/223hosting.com\\\/index.php\\\/author\\\/aarmstrong\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Useful BASH debugging variables - 223 Hosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/","og_locale":"en_US","og_type":"article","og_title":"Useful BASH debugging variables - 223 Hosting","og_description":"Bash variable ${LINENO} show the line number in the current script which useful when debugging scripts. Like: #!\/bin\/bash echo .. foobar echo &#8220;${LINENO}&#8221; # print 4 Bash variables that I find useful for debugging are; ${BASH_COMMAND} \u2192 Last command ran ${BASH_LINENO[@]} \u2192 List line numbers up to that point ${FUNKNAME[@]} \u2192 List functions in stack [&hellip;]","og_url":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/","og_site_name":"223 Hosting","article_published_time":"2021-12-30T15:06:51+00:00","article_modified_time":"2021-12-30T15:06:52+00:00","author":"Andrew Armstrong","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Andrew Armstrong","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/#article","isPartOf":{"@id":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/"},"author":{"name":"Andrew Armstrong","@id":"https:\/\/223hosting.com\/#\/schema\/person\/1ed0a0f9a442289133a9488824aa237f"},"headline":"Useful BASH debugging variables","datePublished":"2021-12-30T15:06:51+00:00","dateModified":"2021-12-30T15:06:52+00:00","mainEntityOfPage":{"@id":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/"},"wordCount":62,"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/","url":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/","name":"Useful BASH debugging variables - 223 Hosting","isPartOf":{"@id":"https:\/\/223hosting.com\/#website"},"datePublished":"2021-12-30T15:06:51+00:00","dateModified":"2021-12-30T15:06:52+00:00","author":{"@id":"https:\/\/223hosting.com\/#\/schema\/person\/1ed0a0f9a442289133a9488824aa237f"},"breadcrumb":{"@id":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/223hosting.com\/index.php\/2021\/12\/30\/useful-bash-debugging-variables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/223hosting.com\/"},{"@type":"ListItem","position":2,"name":"Useful BASH debugging variables"}]},{"@type":"WebSite","@id":"https:\/\/223hosting.com\/#website","url":"https:\/\/223hosting.com\/","name":"223 Hosting","description":"Tales from the digital world of a professional brewer","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/223hosting.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/223hosting.com\/#\/schema\/person\/1ed0a0f9a442289133a9488824aa237f","name":"Andrew Armstrong","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1a05f43db0816ca80246e33d5afe56571c2e4bff6d3f98b8b5dbe404fc516df1?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1a05f43db0816ca80246e33d5afe56571c2e4bff6d3f98b8b5dbe404fc516df1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1a05f43db0816ca80246e33d5afe56571c2e4bff6d3f98b8b5dbe404fc516df1?s=96&d=mm&r=g","caption":"Andrew Armstrong"},"url":"https:\/\/223hosting.com\/index.php\/author\/aarmstrong\/"}]}},"_links":{"self":[{"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":1,"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":12,"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions\/12"}],"wp:attachment":[{"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/223hosting.com\/index.php\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}