{"id":82,"date":"2018-03-12T09:57:31","date_gmt":"2018-03-12T07:57:31","guid":{"rendered":"https:\/\/amsd.go.ro\/wordpress\/?p=82"},"modified":"2021-09-07T11:24:47","modified_gmt":"2021-09-07T08:24:47","slug":"how-to-execute-bash-script-from-an-url","status":"publish","type":"post","link":"https:\/\/amsd.go.ro\/wordpress\/?p=82","title":{"rendered":"How to execute bash script from an URL"},"content":{"rendered":"<div class=\"post-text\">\n<pre class=\"lang-sh prettyprint prettyprinted\"><code><span class=\"pln\">source <\/span><span class=\"pun\">&lt;(<\/span><span class=\"pln\">curl <\/span><span class=\"pun\">-<\/span><span class=\"pln\">s http<\/span><span class=\"pun\">:\/\/<\/span><span class=\"pln\">mywebsite<\/span><span class=\"pun\">.<\/span><span class=\"pln\">com<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">myscript<\/span><span class=\"pun\">.<\/span><span class=\"pln\">txt<\/span><span class=\"pun\">)<\/span><\/code><\/pre>\n<p>ought to do it. Alternately, leave off the initial redirection on yours, which is redirecting standard input; <code>bash<\/code> takes a filename to execute just fine without redirection, and <code>&lt;(command)<\/code> syntax provides a path.<\/p>\n<pre class=\"lang-sh prettyprint prettyprinted\"><code><span class=\"pln\">bash <\/span><span class=\"pun\">&lt;(<\/span><span class=\"pln\">curl <\/span><span class=\"pun\">-<\/span><span class=\"pln\">s http<\/span><span class=\"pun\">:\/\/<\/span><span class=\"pln\">mywebsite<\/span><span class=\"pun\">.<\/span><span class=\"pln\">com<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">myscript<\/span><span class=\"pun\">.<\/span><span class=\"pln\">txt<\/span><span class=\"pun\">)<\/span><\/code><\/pre>\n<p>It may be clearer if you look at the output of <code>echo &lt;(cat \/dev\/null)<\/code><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>source &lt;(curl -s http:\/\/mywebsite.com\/myscript.txt) ought to do it. Alternately, leave off the initial redirection on yours, which is redirecting standard input; bash takes a filename to execute just fine without redirection, and &lt;(command) syntax provides a path. bash &lt;(curl -s [&hellip;]<\/p>\n<div class=\"link-more\"><a href=\"https:\/\/amsd.go.ro\/wordpress\/?p=82#more-82\" class=\"more-link\">Continue reading &#10142; <span class=\"screen-reader-text\">How to execute bash script from an URL<\/span><\/a><\/div>","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8,10,11,12],"class_list":["post-82","post","type-post","status-publish","format-standard","hentry","category-technology","tag-ps_20","tag-ps_32","tag-ps_57","tag-ps_17"],"_links":{"self":[{"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=82"}],"version-history":[{"count":1,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/82\/revisions"}],"predecessor-version":[{"id":162,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/82\/revisions\/162"}],"wp:attachment":[{"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/amsd.go.ro\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}