Dropbox Tip #1 – Share your scripts on all your pcs

OK so this post is crazy simple but something i use all the time so here goes.

Problem. You finally get a bash script working at home and you forget to upload it but you really need it one day at work

Sound familiar? Used to happen to me all the time, well that and reformatting my laptop and forgetting to backup my scripts!!

Solution. Store your scripts in Dropbox and add the folder to you bashrc path

This post assumes you already have dropbox installed (if you havent, get it here cos its ultra cool and you can get a 2gb account free).

There are only two stages involved

Creation a bin folder inside your  dropbox

mkdir ~/Dropbox/bin

Add the dropbox bin folder to your bashrc path.

nano ~/.bashrc

Look for a line that looks like this (often at the end), if its not there create it and make sure you add the dropbox bin folde to the path. Note: You can add as many folders as you like here each seperated by a colon (the two dotted kind, not your lower intestine)

PATH=$PATH:/home/drjnet/Dropbox/bin

Before this will work you need to close the terminal window and start a new one,  the new path will then be accesible.

Make sure your scripts are executable as you normally would and you can run as usual, however now the scripts will be on all your dropbox enabled pcs too..

Repeat Stage 2 on all your other pcs (of course making sure dropbox is installed and synced first).

Additional note: You will need to make the scripts executable on all the pcs you have got dropbox on as the permissions are only relative to the local machine.

chmod +x ~/Dropbox/bin/*

Or do each file as you need to.

Another cool use of dropbox, many to follow!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s