{"id":8391,"date":"2021-11-09T16:41:45","date_gmt":"2021-11-09T21:41:45","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=8391"},"modified":"2021-11-09T16:41:45","modified_gmt":"2021-11-09T21:41:45","slug":"bash-spaces-quotes-and-string-replacement","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=8391","title":{"rendered":"Bash &#8211; Spaces, Quotes, and String Replacement"},"content":{"rendered":"<p>Had to figure out how to do string replacement (Scott wanted to convert WMA files to similarly named MP3 files) and pass a single parameter that has spaces into a shell script.<\/p>\n<p>${original_string\/thing_to_find\/thing_to_replace_there} does string replacement. And $@ is the unexpanded parameter set. So this <em>wouldn&#8217;t<\/em> work if we were trying to pass in more than one parameter (well, it *would* &#8230; I&#8217;d just have to custom-handle parameter expansion in the script)<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=8392\" rel=\"attachment wp-att-8392\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8392\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/BashSpacesAndQuotes.png\" alt=\"\" width=\"665\" height=\"148\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/BashSpacesAndQuotes.png 665w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2021\/11\/BashSpacesAndQuotes-300x67.png 300w\" sizes=\"auto, (max-width: 665px) 100vw, 665px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Had to figure out how to do string replacement (Scott wanted to convert WMA files to similarly named MP3 files) and pass a single parameter that has spaces into a shell script. ${original_string\/thing_to_find\/thing_to_replace_there} does string replacement. And $@ is the unexpanded parameter set. So this wouldn&#8217;t work if we were trying to pass in more &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,30],"tags":[632,294,634],"class_list":["post-8391","post","type-post","status-publish","format-standard","hentry","category-coding","category-system-administration","tag-bash","tag-linux","tag-shell-script"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8391"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8391\/revisions"}],"predecessor-version":[{"id":8393,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8391\/revisions\/8393"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}