Hacker News new | past | comments | ask | show | jobs | submit login
Bashstrap – For your OS X terminal (github.com/barryclark)
73 points by barryclark on Dec 22, 2013 | hide | past | favorite | 51 comments



I remember spending so many happy hours customizing bash back in my early years with unix. Now I'm older and wiser, and I just use fish.

http://fishshell.com

I think that it should be especially appreciated by those who use OSX for its "it just works" approach. A couple of pro tips:

* Instead of running chsh to change your default login shell just change the shell command for Terminal.app it iTerm. This means that scripts in cron etc will still run under bash and you won't break anything accidentally.

* Just like with zsh if you want to get customized there is something called oh-my-fish that helps a bit, but seriously you're 90% there with the defaults.


My tutorial for setting up fish on Mac OS X and Ubuntu: http://hackercodex.com/guide/install-fish-shell-mac-ubuntu/

I've never had any trouble using chsh to make fish the default shell. Bash scripts in crontabs still run under bash -- not sure why anyone would think otherwise. Plus, changing the shell command for iTerm/Terminal won't help with remote servers, so using chsh everywhere means you always get a consistent shell experience, no matter whether you're using your terminal locally or remotely.


Fish is wonderful, but as someone who is novice to middling in skill (2 years), I found the fact that it had a different set of syntaxes to be difficult to work with. Instructions for random things to install I found all used bash syntax, which broke when used in fish.

I've since switched to zsh, and I am terribly happy with it. It has a lot of the nice advanced features that fish has, without breaking from bash syntax.


You shouldn't have any issues changing your default shell via chsh. SHELL is, by default, set to /bin/sh by cron—you can also define this yourself.

http://www.gnu.org/software/mcron/manual/html_node/Crontab-f...


I like it but the lack of vi mode is a deal breaker for me...

The ticket for it has been open for 2 years but it seems that it's finally getting close to implementation...

https://github.com/fish-shell/fish-shell/issues/65


Clicked on comments to say the same. When I discovered fish, I felt like "where have I been". But there's one downside though: I got used (used as in muscle reflexes) to things like ls -l `where something` and they do not work anymore, fish is not backwards compatible with bash.


What's wrong with "ls -l (which cmd)"?


Nothing wrong, but just a lack of muscle reflex. I've been using bash for what, almost 20 years?


Agreed. In my experience fish just runs a heck of a lot faster than either zsh or bash as well as adding some features I love, like the command syntax highlighting and autocomplete. I couldn't see myself going back to either of those after using it for an extended period of time.


I tried it, then went back to bash. I'm not really sure why. I also tried zsh some time ago, then went back to bash. I rather like fish, it's a cool construct, and I can appreciate its features. But somehow I found that I didn't really gain anything from them, so I went back to bash. I honestly admit I'm not sure why -- fish is really cool, and zsh is really cool, but I didn't adapt the new features to my day to day usage.


I would like to use fish shell but my .bash_profile is setup exactly as I want it, and when I've switched to other shells before (zsh) it has been a general pain in the ass. How do I retain my current bash settings in fish shell?


Calling this "Bootstrap for Bash" is pretty disingenuous, all I can see are a bunch of configuration files that are very basic and hard-coded to your own usage.


  It cuts out the fluff
To me it looks like the exact opposite.


I had the same feeling. I already know my username, and if there's a directory name before my prompt the "in" is implicit.


Do you know your username when you are using connected to a tmux over ssh that may or may not have another, very similar, server running inside of a screen?


Which is why you setup your shell (bash/zsh/fish) to check for the existence of $SSH_CLIENT. If it exists, you can assume you're connecting via SSH and add username and hostname to $PS1.


You are not alone.

I'd go further and say anyone who prefers Bash is someone who does not mind a little or even a lot of fluff.


This is just some fancied up bashrc.

A (much) better alternative would be to install zsh with oh-my-zsh (https://github.com/robbyrussell/oh-my-zsh).


zsh is broken and breaks X times per year. It's annoying, really. I'm tired of wasting time configuring terminals time and again because the new version of XYZ package is broken.

Anyone who does not enjoy spending huge amounts of time trouble-shooting on the terminal should use bash. It's the default in most distributions, it supports all major features a modern shell should.


Never ran into any problems with vanilla zsh on Arch, Debian, or OSX -- just pacman -Ss zsh || apt-get install zsh || brew install zsh. What kind of problems did you run into?


Yep! I did take a look at oh-my-zsh but decided not to go that route, I didn't like the aesthetic of many of the themes and Bash is capable of a lot of zsh's features now.


> Bash is capable of a lot of zsh's features now.

Were some new features added to Bash that were present in zsh?


I may be wrong, but I think programmable completion and /* globs were in zsh before bash.


Came here to say the same. +1 to oh my zsh


This is quite sad, for a better alternative starter check out Paul Irish's which seems to be based on mathias's. The link is here: https://github.com/paulirish/dotfiles


Indeed, looks like Bashstrap is a fork of my dotfiles (without giving any credit, sadly). A lot of the commands, file structure, and even parts of the readme are a direct copy-paste.


It contains this description:

Bootstrap for your terminal. A quick way to spruce up OSX terminal. It cuts out the fluff, adds in timesaving features, and provides a solid foundation for customizing your terminal style. Based on Mathias Bynens epic dotfiles - https://github.com/mathiasbynens/dotfiles*

Or was that added after posting it here?


That was added after posting it here. https://news.ycombinator.com/item?id=6951288


Since everyone likes mentioning oh-my-zsh I figured I would mentioned prezto

https://github.com/sorin-ionescu/prezto

which is a very nice alternative and much smaller.


^This. Prezto a git workflow makes personalization easily maintainable and deployment in new environments a snap.


bash alternate to oh-my-sh : https://github.com/revans/bash-it. https://github.com/mathiasbynens/dotfiles has a pretty good collection of dotfiles repos mentioned in its readme.md. There are few more at http://dotfiles.github.io/


https://github.com/mathiasbynens/dotfiles is fantastic, I refer to that a lot.


Actually, it looks like Bashstrap is a fork of https://github.com/mathiasbynens/dotfiles. A lot of the commands, file structure, and even parts of the readme are a direct copy-paste…


I just added credit into the repo description. Thanks Mathias!


I thank you for that repo. I forked, customised, and occasionally cherry-pick from dotfiles, and it has improved my everyday terminal use significantly.


I'm a zsh-er and use oh-my-zsh, but I borrowed the syntax highlighting, called it `sat` short for "source cat", and piped through less for paginated output:

  # before use: [sudo] easy_install pygments
  alias sat='pygmentize -O style=monokai -f console256 -g | less'
I like these kinds of projects, because someone always shows me something in my set up I don't have, and it's really trivial to borrow from them.

In return, I feel everyone should have a proper git log alias, here's mine:

  alias logg="git log --graph --oneline --all --decorate --abbrev-commit"
Example output: http://d.pr/i/B9LT


Instead of that git command, I just default to running "tig": http://blogs.atlassian.com/2013/05/git-tig/ available everywhere it counts (arch, debian, homebrew)


That's awesome. Will definitely be adding it in, thanks!


The one thing I always add to my profile is "export COMMAND_MODE=unix2003". This will make some commands behave as you would expect them to under Linux instead of BSD.

Don't recall seeing that in my brief scan of the dotfiles.


For the record: COMMAND_MODE=unix2003 is already default in Terminal(.app), but it should definitely be set for iTerm.


The one area where I see this lacking is git autocomplete. Also personally I wouldn't use the `s .` command for Sublime... maybe you could make some of the aliases configurable rather than default?


Oh My ZSH works very well for me. Love it


+1 for Oh My Zsh. Has plugins for git, sublime_text, etc, and great support.


You guys may want to check out prezto too: https://github.com/sorin-ionescu/prezto


If you are interested in just the prompt, checkout https://github.com/twolfson/sexy-bash-prompt


I like Thoughtbot's dotfiles. https://github.com/thoughtbot/dotfiles


I have done something similar for bash, but its portable across iTerm and Terminal app. https://github.com/gauravagarwalr/Script-BackUp/tree/master/...


What's wrong with $EDITOR?

Why would I want a terminal command for using a GUI editor?

Why would I want a GUI editor at all?


>Why would I want a terminal command for using a GUI editor?

Because you use Sublime Text and you spend a lot of time at the CLI?


Where can I find a list of those unicode prompts?


I usually pull from there tables - http://en.wikipedia.org/wiki/Unicode_symbols




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: