{"id":1367,"date":"2020-11-05T13:42:39","date_gmt":"2020-11-05T00:42:39","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1367"},"modified":"2020-11-05T13:45:53","modified_gmt":"2020-11-05T00:45:53","slug":"using-dos2unix","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1367","title":{"rendered":"Using dos2unix"},"content":{"rendered":"<p>Sometimes we wrote a script <strong>intended for linux<\/strong> but we are using <strong>windows<\/strong>. However, when we deploy the script to linux it doesn't work.<\/p>\n<p>For example you've created the file <strong>helloworld.sh<\/strong> in windows with the following content:<\/p>\n<pre><code class=\"language-bash\">#!\/bin\/sh\necho &quot;Hello World&quot;<\/code><\/pre>\n<p><strong>Transport helloworld.sh to linux<\/strong> and <strong>make it executable<\/strong> <em>(i.e. using the command <strong>chmod 755 helloworld.sh<\/strong>)<\/em>. Execute it using the following command:<\/p>\n<pre><code class=\"language-sh\">.\/helloworld.sh<\/code><\/pre>\n<p>Expect to see something similar to the following error:<\/p>\n<pre><code class=\"language-sh\">-bash: .\/helloworld.sh: \/bin\/sh^M: bad interpreter: No such file or directory<\/code><\/pre>\n<p>To remedy this, run <strong>dos2unix command with helloworld.sh<\/strong> as follows:<\/p>\n<pre><code class=\"language-sh\">dos2unix helloworld.sh<\/code><\/pre>\n<p>Expect an output similar to the following:<\/p>\n<pre><code class=\"language-sh\">dos2unix: converting file helloworld.sh to Unix format...<\/code><\/pre>\n<p>After this, <strong>execute the helloworld.sh<\/strong> again and expect no error.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes we wrote a script intended for linux but we are using windows. However, when we deploy the script to linux it doesn&#8217;t work. For example you&#8217;ve created the file helloworld.sh in windows with the following content: #!\/bin\/sh echo &quot;Hello World&quot; Transport helloworld.sh to linux and make it executable (i.e. using the command chmod 755 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[55,28],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1367"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1367"}],"version-history":[{"count":2,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1367\/revisions"}],"predecessor-version":[{"id":1369,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1367\/revisions\/1369"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}