Settings

Theme

Shell startup scripts

blog.flowblok.id.au

48 points by gaymish 13 years ago · 9 comments

Reader

laumars 13 years ago

As much as I'm OCD about this sort of thing myself, I can't help thinking that this guy is trying to solve a problem that doesn't exist.

The biggest problem I have if just the effort of keeping all the environments unified on all the boxes I administrate. Because of this, these days I just don't bother with large and complicated custom shell environments - just a few aliases on my workstation and that's about it.

The crux of the matter is if time spent trying to keep your environment in sync across your infrastructure is greater than the time you save due to increased productivity - then it's really just a wasted exercise.

What I'd be more interested in is a way to have a .remote.bashrc running on my workstation that will then automatically set the environment for any servers I SSH into (thus removing the need for me to keep copies on each server).

Actually, that last idea should be pretty easy, I've just never thought about it until now....

  • wting 13 years ago

    With today's tools it's not that difficult to sync your shell environment. Keep your config files in a private git repo and add a few lines to your .bashrc that does the following in the background:

      - git (pull|rebase|reset --hard) from repo
      - recreate all symlinks
    
    Any time you make changes, push it up to the repo. An alternative for some is to symlink against files stored in Dropbox.
    • flowblok 13 years ago

      and for the "recreate all symlinks" step, you can use your vcs to determine which symlinks need to be changed.

  • ohkine 13 years ago

    In ~/.ssh/config there is a directive called LocalCommand that you can use to do an rsync (or anything else you want) just prior to making the connection. This way you can have it automatically update remote hosts with your shell scripts each time you connect.

    • laumars 13 years ago

      Now that's what I'm talking about!

      And here's me thinking I'd have to manually write a simple wrapper to do this.

      Thanks a million :)

michaelhoffman 13 years ago

This page is worth bookmarking just for the incredibly helpful diagrams, if nothing else.

chubot 13 years ago

related: http://news.ycombinator.com/item?id=4369485

dfc 13 years ago

"If you’re a regular shell user...I suspect that few people know when things like .bash_profile and .bashrc actually get executed."

Really?

cmccabe 13 years ago

This is way too complex. Just put everything in .bashrc and symlink .profile to .bashrc. Then if there's something you don't want executed in non-interactive mode in .bashrc, put it in an if statement.

Simple.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection