开发者

Share scripts and profiles with Dropbox

I'm new to bash, but eager to learn. Right now I'm stealing useful scripts from other ppl and are wondering where I should put them. So I have a bunch of *.sh files, but don't know where they should go. To make it even more useful I would like a way to share them with my other puter with D开发者_运维问答ropbox. Is it as simple as linking the dropbox folder to the right place?

Sincerly R


If the scripts are "general purpose" the best place to put them is in ~/bin then they always will be available from the cmd-line (i.e. if that folder is in $PATH)

One approach is to use mercurial via bitbucket or git via github

Create an account there and add your scripts. There are many advantages to this approach, some of them are

  • all your scrips are just e.g. a git clone away if you are on a new machine.
  • with a e.g. git pull your environment is updated to the latest
  • everything is under SCM management, which means you can merge, diff, commit everything you do.

After a while you will probably add your dotfiles there as well (that is what I do), then whenever I'm forced to use a new machine, it will only take seconds to set up my favorite environment! There are many post here on SO about managing your dotfiles, just search for that term and start reading...


Since you mentioned Dropbox, you might consider making a bin folder there and adding that directory to your PATH. You could also make a universal bash_profile file and put it on Dropbox. That's what I do. Not to be self-promoting, but I blogged about it here: https://blog.iharder.net/2011/03/17/bash-profile-sharing-and-useful-scripts/trackback/

Important lines for your ~/.bash_profile (or ~/.bashrc on some systems) file:

test -r ~/Dropbox/bin/bash_profile && . ~/Dropbox/bin/bash_profile

export PATH=~/Dropbox/bin:$PATH

-Rob

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜