{"id":1200,"date":"2012-05-25T13:03:53","date_gmt":"2012-05-25T11:03:53","guid":{"rendered":"http:\/\/blog.f12.no\/wp\/?p=1200"},"modified":"2012-05-25T13:03:53","modified_gmt":"2012-05-25T11:03:53","slug":"bash-3-default-values","status":"publish","type":"post","link":"https:\/\/blog.f12.no\/wp\/2012\/05\/25\/bash-3-default-values\/","title":{"rendered":"Bash #3 &#8211; Default values"},"content":{"rendered":"<p>When handling parameters from the command line I usually want one or two parameters to have a default value. In Bash I can achieve this through:<\/p>\n<p><code>DIRECTORY=${DIRECTORY_FROM_COMMAND_LINE:-\"\/tmp\"}<\/code><\/p>\n<p>Where &#8220;DIRECTORY_FROM_COMMAND_LINE&#8221; is just another variable and thus can be 1 (for $1).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When handling parameters from the command line I usually want one or two parameters to have a default value. In Bash I can achieve this through: DIRECTORY=${DIRECTORY_FROM_COMMAND_LINE:-&#8220;\/tmp&#8221;} Where &#8220;DIRECTORY_FROM_COMMAND_LINE&#8221; is just another variable and thus can be 1 (for $1).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7,12],"tags":[23,52,126],"class_list":["post-1200","post","type-post","status-publish","format-standard","hentry","category-development","category-os-tricks","tag-bash","tag-devops","tag-scripting"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_likes_enabled":false,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.f12.no\/wp\/wp-json\/wp\/v2\/posts\/1200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.f12.no\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.f12.no\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.f12.no\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.f12.no\/wp\/wp-json\/wp\/v2\/comments?post=1200"}],"version-history":[{"count":0,"href":"https:\/\/blog.f12.no\/wp\/wp-json\/wp\/v2\/posts\/1200\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.f12.no\/wp\/wp-json\/wp\/v2\/media?parent=1200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.f12.no\/wp\/wp-json\/wp\/v2\/categories?post=1200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.f12.no\/wp\/wp-json\/wp\/v2\/tags?post=1200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}