{"id":109,"date":"2006-11-23T15:42:28","date_gmt":"2006-11-23T14:42:28","guid":{"rendered":"http:\/\/reflection-design.dk\/?p=109"},"modified":"2006-11-23T15:42:28","modified_gmt":"2006-11-23T14:42:28","slug":"use-your-own-scripts-in-ubuntu","status":"publish","type":"post","link":"https:\/\/reflection-design.dk\/?p=109","title":{"rendered":"Use your own scripts in Ubuntu"},"content":{"rendered":"<p>Sometimes tedious tasks can be simplified by writing a simple bash script to perform them. Now i will not go into details on how to write scripts in Bash, but instead show how you can easily make your scripts available from anywhere in your terminal.<\/p>\n<p>First off open up a terminal, and in your home directory create a directory named &#8216;scripts&#8217;. As you might have guessed all your scripts will be placed here. For each script file you place here do the following:<\/p>\n<blockquote><p>chmod +x scriptname.sh<\/p><\/blockquote>\n<p>This will ensure that your script is executable, so no more need to type &#8216;sh&#8217; before running the script. So now you have a directory of executable script, but so far they can only be accessed from either the directory itself, or by typing the path to the script. So we edit our .bashrc file a little. This file is located in your home directory.<\/p>\n<blockquote><p>gedit .bashrc<\/p><\/blockquote>\n<p>Scroll down to the bottom of the file, and add the following line<\/p>\n<blockquote><p>export PATH=$PATH:\/home\/USERNAME\/scripts\/<\/p><\/blockquote>\n<p>Of course replace USERNAME with your own username\/homedirectory. Now reload the file with<\/p>\n<blockquote><p>source .bashrc<\/p><\/blockquote>\n<p>And you are all set. Any shell script you now place in scripts can be executed from anywhere on the system. The only requirement is to chmod +x on the file first \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes tedious tasks can be simplified by writing a simple bash script to perform them. Now i will not go into details on how to write scripts in Bash, but instead show how you can easily make your scripts available from anywhere in your terminal. First off open up a terminal, and in your home [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5],"tags":[93],"class_list":["post-109","post","type-post","status-publish","format-standard","hentry","category-articles","category-linuxunix","tag-ubuntu-linux"],"_links":{"self":[{"href":"https:\/\/reflection-design.dk\/index.php?rest_route=\/wp\/v2\/posts\/109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/reflection-design.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/reflection-design.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/reflection-design.dk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/reflection-design.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=109"}],"version-history":[{"count":0,"href":"https:\/\/reflection-design.dk\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions"}],"wp:attachment":[{"href":"https:\/\/reflection-design.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reflection-design.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reflection-design.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}