{"id":229,"date":"2012-03-04T11:22:59","date_gmt":"2012-03-04T11:22:59","guid":{"rendered":"http:\/\/www.plugged.in\/?p=229"},"modified":"2012-03-04T11:22:59","modified_gmt":"2012-03-04T11:22:59","slug":"a-bash-script-to-detect-os-info","status":"publish","type":"post","link":"https:\/\/www.veriteknik.net.tr\/en\/a-bash-script-to-detect-os-info\/","title":{"rendered":"A Bash Script to Detect OS Info"},"content":{"rendered":"<p>Here&#8217;s a simple bash script snippet I use for detecting the OS information on the current system.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">#!\/bin\/bash\n### Getting OS Information\nif [ -f \/etc\/lsb-release ]; then\n. \/etc\/lsb-release\nDIST=$DISTRIB_ID\nDIST_VER=$DISTRIB_RELEASE\nelse\nDIST=\"Unknown\"\nDIST_VER=\"Unknown\"\nfi\nif [ -f \/etc\/debian_version ]; then\nOS=\"Debian\"\nVER=$(cat \/etc\/debian_version)\nelif [ -f \/etc\/redhat-release ]; then\nOS=\"Red Hat\"\nVER=$(cat \/etc\/redhat-release)\nelif [ -f \/etc\/SuSE-release ]; then\nOS=\"SuSE\"\nVER=$(cat \/etc\/SuSE-release)\nelse\nOS=$(uname -s)\nVER=$(uname -r)\nfi<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a simple bash script snippet I use for detecting the OS information on the current system. #!\/bin\/bash ### Getting OS Information if [ -f \/etc\/lsb-release ]; then . \/etc\/lsb-release DIST=$DISTRIB_ID DIST_VER=$DISTRIB_RELEASE else DIST=&#8221;Unknown&#8221; DIST_VER=&#8221;Unknown&#8221; fi if [ -f \/etc\/debian_version ]; then OS=&#8221;Debian&#8221; VER=$(cat \/etc\/debian_version) elif [ -f \/etc\/redhat-release ]; then OS=&#8221;Red Hat&#8221; VER=$(cat \/etc\/redhat-release) [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[370],"tags":[451,371],"yst_prominent_words":[],"class_list":["post-229","post","type-post","status-publish","format-standard","hentry","category-linux","tag-bash","tag-linux-2"],"jetpack_featured_media_url":"","uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Mustafa Emre Ayd\u0131n","author_link":"https:\/\/www.veriteknik.net.tr\/en\/author\/eaydin\/"},"uagb_comment_info":0,"uagb_excerpt":"Here&#8217;s a simple bash script snippet I use for detecting the OS information on the current system. #!\/bin\/bash ### Getting OS Information if [ -f \/etc\/lsb-release ]; then . \/etc\/lsb-release DIST=$DISTRIB_ID DIST_VER=$DISTRIB_RELEASE else DIST=\"Unknown\" DIST_VER=\"Unknown\" fi if [ -f \/etc\/debian_version ]; then OS=\"Debian\" VER=$(cat \/etc\/debian_version) elif [ -f \/etc\/redhat-release ]; then OS=\"Red Hat\" VER=$(cat \/etc\/redhat-release)&hellip;","_links":{"self":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/comments?post=229"}],"version-history":[{"count":0,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/posts\/229\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/media?parent=229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/categories?post=229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/tags?post=229"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.veriteknik.net.tr\/en\/wp-json\/wp\/v2\/yst_prominent_words?post=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}