{"id":15,"date":"2009-08-08T16:53:33","date_gmt":"2009-08-08T16:53:33","guid":{"rendered":"http:\/\/www.adriangrigoras.com\/blog\/?p=15"},"modified":"2009-08-08T16:53:33","modified_gmt":"2009-08-08T16:53:33","slug":"bash-current-folder","status":"publish","type":"post","link":"https:\/\/adriangrigoras.com\/blog\/bash-current-folder\/","title":{"rendered":"Bash current folder"},"content":{"rendered":"<p>Sometimes, if you run some bash scripts from cronjob or with the absolute path you will receive an error like this:<\/p>\n<blockquote>\n<address>Can&#8217;t open perl script &#8220;backup.cgi&#8221;. No such file or directory.<\/address>\n<\/blockquote>\n<p>To solve this, you must make sure you set bash to read from the directory where it is located:<\/p>\n<blockquote>\n<address>cd $(dirname $0)<\/address>\n<\/blockquote>\n<p>This will solve your problem.<\/p>\n<div id=\"_mcePaste\" style=\"overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;\">apache-2009-7-8-175222.tar.gzSometimes, if you run some bash scripts from cronjob or with the absolute path you will receive an error like this:<\/p>\n<p>apache-2009-7-8-175222.tar.gz<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, if you run some bash scripts from cronjob or with the absolute path you will receive an error like this: Can&#8217;t open perl script &#8220;backup.cgi&#8221;. No such file or directory. To solve this, you must make sure you set bash to read from the directory where it is located: cd $(dirname $0) This will\u2026 <span class=\"read-more\"><a href=\"https:\/\/adriangrigoras.com\/blog\/bash-current-folder\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,11],"tags":[],"class_list":["post-15","post","type-post","status-publish","format-standard","hentry","category-bash","category-linux"],"_links":{"self":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":0,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"wp:attachment":[{"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adriangrigoras.com\/blog\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}