Giter Club home page Giter Club logo

bash-it's Introduction

logo

Build Status Docs Status License shell

Bash-it is a collection of community Bash commands and scripts for Bash 3.2+. (And a shameless ripoff of oh-my-zsh πŸ˜ƒ)

Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more.

Bash-it provides a solid framework for using, developing and maintaining shell scripts and custom commands for your daily work. If you're using the Bourne Again Shell (Bash) regularly and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you!
Stop polluting your ~/bin directory and your .bashrc file, fork/clone Bash-it and start hacking away.

Installation

  1. Check out a clone of this repo to a location of your choice, such as git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it
  2. Run ~/.bash_it/install.sh

That's it! πŸ˜ƒ

You can check out more components of Bash-it, and customize it to your desire.
For more information, see detailed instructions here.

Contributing

Please take a look at the Contribution Guidelines before reporting a bug or providing a new feature.

The Development Guidelines have more information on some of the internal workings of Bash-it, please feel free to read through this page if you're interested in how Bash-it loads its components.

Contributors

List of contributors

License

Bash-it is licensed under the MIT License.

bash-it's People

Contributors

arimourao avatar barbuk avatar buhl avatar cornfeedhobo avatar davidpfarrell avatar demula avatar dnoiz1 avatar dot-1q avatar edubxb avatar erichs avatar font avatar gaelicwizard avatar ipoval avatar jfsiii avatar kigster avatar laniksj avatar leventyalcin avatar lfelipe1501 avatar mimoralea avatar muniftanjim avatar noahgorny avatar noqqe avatar nwinkler avatar revans avatar rico-chet avatar ryankanno avatar seefood avatar tbhaxor avatar thedrow avatar tswicegood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bash-it's Issues

rvm and virtualenv plugins fight

If you have rvm enabled, it complains about not being the first thing in $PATH.
When you activate a virtualenv, this places the venv's path first, and rvm begins to complain.

I don't know what "the right thing" would be to do here.

rgb color, how to?

it's not clear how to use your own rgb color values for the themes/prompt. could someone please point me in the right direction? thanks

moving specific things away .bash_profile

Hi,

since i use bash-it i wonder why all these specific things are placed in bash_profile
i'm talking about:

     export JEKYLL_LOCAL_ROOT="$HOME/Sites/jekyllsite"
     export JEKYLL_REMOTE_ROOT="user@server:/path/to/jekyll/root"
     [...]

and other nginx git_host or rvm stuff. I think you know what i mean. Wouldn't it be better (and maybe more user friendly) if such things are separately placed in lib/jekyll.bash oder in plugins/jekyll.plugin.bash ?

When a new user downloads bash-it, he will see plugins or lib files and remove the ones he doesn't need. thats all. otherwise he got to edit .bash_profile and things as well. this were at least my first steps with bash-it

i think .bash_profile should contain only the basic and general things which are required to use the framework.

just my 2 cents ;)

Completion can't depend on plugins

I want to add completion for NPM and I have a script that will do it. However, there's a dependency problem. I'm using the nvm plugin to load Node.js and NPM, and my completion script needs NPM to be loaded before it runs. bash-it currently loads aliases, then completion, then plugins, like so:

for file_type in "aliases" "completion" "plugins"
do
  _load_bash_it_files $file_type
done

Is there any particular reason this is done? If plugins were loaded first, then aliases and completion scripts could depend on them. As far as I can tell, plugins get no benefit from having aliases and completion loaded first.

Install script attempts to backup ~/.bash_profile when it does not exist

The install script attempts to backup ~/.bash_profile when it does not exist.

$ ~/.bash_it/install.sh 
cp: /Users/sgerrand/.bash_profile: No such file or directory
Your original .bash_profile has been backed up to .bash_profile.bak

Adding a test for the existence of that file (test -f ~/.bash_profile) or, even better, that the user can write to it (test -w ~/.bash_profile) would fix this issue.

hg branch grep+awk problem

on SCM prompt for Mercurial 'hg summary' will report branch heads, the grep for 'branch' passes two matches to awk, adding extra unwanted text to $SCM_BRANCH

issue fixed, pull request incoming.

Gem completion and slow loading

Gem completion script makes each new terminal window take ages to load. Just deleting the symlink from enabled completions folder makes it load reasonable well.

Slight problems with install.sh

sh install.sh

cp: cannot stat //.bash_profile': No such file or directory Your original .bash_profile has been backed up to .bash_profile.bak cp: cannot stat//.bash_it/template/bash_profile.template.bash': No such file or directory
Copied the template .bash_profile into ~/.bash_profile, edit this file to customize bash-it
Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] n
Would you like to enable all, some, or no aliases? Some of these may make bash slower to start up (especially completion). (all/some/none) all
mkdir: cannot create directory //.bash_it/aliases/enabled': No such file or directory ln: creating symbolic link//.bash_it/aliases/enabled': No such file or directory
Would you like to enable all, some, or no plugins? Some of these may make bash slower to start up (especially completion). (all/some/none) ^C

^^^ At this point I stopped. The thing is, I am the superuser, but for some reason I am logged in with sh and not bash, and my HOME directory at /root is not recognized.

As a consequence, some assumptions do not work.

The one that I think is the biggest problem is this one here:

mkdir: cannot create directory `//.bash_it/aliases/enabled': No such file or directory

It should first create the directory .bash_it and then create the directory aliases.

Git flow autocompletion not working

I tried to find an irc channel or something so I didn't have to file an issue, but couldn't find any.
Basically if I type git, it completes flow, but after the git flow nothing gets completed.

No clue what's happening and no clue how to fix it :/

Thanks for this great project!

Slight issue with enable-plugin

Hey, just pulled your recent changes, that created the enable-plugin command, which doesn't seem to be working right.
Every plugin i try to enable with it seems to get an incorrect symlink. "?[0m" gets appended to the name of the file in the enabled directory.
Plugins i've tried with it are git, dirs, fasd, tmux, ssh

Wrap-around command-line

in gnome-terminal, when enabling any of the themes, the prompt is wrapped back to the start of the line

bash_profile vs bashrc

Forgive me if this has been raised and decided, but the issue searchbox did not reveal such...

I'm wondering why this toolkit focuses on wedging into .bash_profile when .bashrc seems to be generally accepted as the starting point for interactive bash sessions?

I follow what I'd gathered to be a generally accepted practice of a trivial bash_profile which exists primarily to invoke .bashrc, whose only other entries are to configure items I'd use from cron or some remote execution tool.

(in fact I carry this a bit further, having a separate .bashrc.interactive or .bashrc.local for the truly local interactive stuff).

I'm busily hacking on my own local branch to refactor for the above, but want to step back and think about how I can give back.

(background: I spend hours logged in as the daemon user for a particular application for administration. I'm hoping this toolkit can help me standardize those admin environments but my prime directive is "First, do no harm" to the app's auto-customized shell environment. I'm leaning toward an installation that requires manual sourcing for that particular environment, but elsewhere, a cleaner merge into existing startup files.)

How to change prompt dynamically every command?

There's a common use case for displaying a colorized character as an indication if the previous command exited cleanly or not.

I can't figure out how to re-invoke prompt change after every command, so that it would change based on previous actions.

Leaving bash-it

I've recently switched over from bash to zsh and therefore won't be able to do much on this project, I just wanted to let everyone know this (I'm not sure of any other way than adding an issue, sorry).

Restart required after installing bash-it

After installing bash-it, I had to restart the terminal window/tab for bash-it to become active. In my opinion, it should be mentioned in the installation instructions in the README.

Terminal application: iTerm
OS: Mac OS X 10.7.4

Feedback : put a user repository into $XDG_CONFIG_HOME/bash-it

Hello,

First, let me tell that I find this project awesome, so thank you for that.
Second, this is not a bug, this is feedback, a suggestion, a question.
Such things don't play well at all with bugtrackers that were designed to... well track bugs
But since few developers know very useful tools like https://www.uservoice.com/ , I post my feedback here.


A little thing bugs me with bash-it
It follows the bad very old idea to hide config files right under $HOME
This was fine when you had only to configure .bashrc and .emacs, but this got out of control since a long time.

That's why the $XDG_CONFIG_HOME variable was invented in the first place
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

I happen to use macosx, but I have precisely the same problem.
All my pet projects, most forked from github, are stored in $HOME/github
bash-it is an exception here and I found it weird.
But ok I will do an exception.
So I opened GitHub.app, will do "File -> Add local directory"
Here the standard MacosX's Open Dialog pop up
I browse to $HOME
Same problem : hidden files are not shown (because it doesn't scale well)

So I had to browse the web to find a work-around, a shortkey that displays hidden files, get the job done.

With the dialog box as the front-most window (you can click once in the dialog box to make sure it’s in front), press the command, shift, and period keys at the same time.

Ok, but now I'm pretty sure that I will forget it soon, and that most people don't know it either.

Suggestion:

improve the documentation so that people put their copy of bash-it in $XDG_CONFIG_HOME, $HOME by default

git global ignore

Can we add a git global ignore?

# File: git-global-ignore

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db

# from sublime text editor
package.sublime-workspace

In .gitconfig (under ~/)

[core]
  excludesfile = /path/to/git-global-ignore

Incorrectly aliasing shuf to gshuf

The following code is incorrectly aliasing shuf to gshuf:

which gshuf &> /dev/null
if [ $? -eq 1 ]
then
    alias shuf=gshuf
fi

This will only ever alias shuf to gshuf if gshuf does not exist in the PATH, which is wrong (I'm guessing a typo or something). Here's the correct code:

which gshuf &> /dev/null
if [ $? -eq 0 ]
then
    alias shuf=gshuf
fi

Hope that helps :)

Not works in non-english locale

One issue, I had found with non-english locale: all commands bash-it do not work. Simple patch:

helpers.bash:83
[ -n "$(LANG=C type -a $1 2>/dev/null | grep 'is a function')" ]

autotest / rvm / autofeature=true / iconv

loading autotest/cucumber_rails_rspec2
Autotest style autotest/cucumber_rails_rspec2 doesn't seem to exist. Aborting.

For reasons beyond my own bash-it declares some extra environment variables, one of which was AUTOFEATURE=true;

autotest will die horribly with **AUTOFEATURE=true* when **iconv* is not listed in your dependencies (Gemfile), cucumber depends on iconv for json.

What still worries me is why bash it was declaring all those environment vars

sigh closable

fix the wiki

The wiki links to the project page, this is confusing. Also (this should be a separate issue, but while we're at it) it'd be nice for the wiki to have screenshots like oh-my-zsh's wiki!

Install asks for todo like 5 times in a row:

Would you like to enable the todo plugins? [Y/N] n
...
Would you like to enable the todo: plugins? [Y/N] n
Would you like to enable the todo plugins? [Y/N] n
Would you like to enable the todo plugins? [Y/N] n
Would you like to enable the todo_completion plugins? [Y/N] 

utterly broken code everywhere

sorry to be a doomsayer.

for starters, this file is full of function definitions that work based on pure luck alone
https://github.com/revans/bash-it/blob/master/lib/preexec.bash
defining a function with "function name ()" is broken, unportable, and not guaranteed to work across bash versions. see http://mywiki.wooledge.org/BashPitfalls#pf25

here is an example of inconsistency in function definitions https://github.com/revans/bash-it/blob/master/lib/history.bash

and this file has mixed definitions https://github.com/revans/bash-it/blob/master/lib/helpers.bash

you're writing bash-specific code; use the tools to your advantage. single-bracket test ( [ ... ] ) is fully discouraged when writing scripts with a bash shebang. use double-bracket test ( [[ ... ]] ) instead -- ESPECIALLY since you don't properly quote your substitutions and expansions ever. expansions within [[ .. ]] are not subject to word-splitting which saves you the headache of writing good code in some situations. refer to http://mywiki.wooledge.org/tests and http://mywiki.wooledge.org/WordSplitting for more information.

https://github.com/revans/bash-it/blob/master/lib/composure.sh
in this file, you defined transcribe() twice. redundant. you also define a function to echo some keywords, which you later re-use to compose other functions to execute `:' through eval. now you can get away with the misappropriated use of eval here thanks to your finite & known input but you really shouldn't be doing this at all. first, composure_keywords() shouldn't be a function. it should be an array, expanded with ''for keyword in "${composure_keywords[@]}"; do ...; done''

also i'm pretty positive you meant "composition" rather than "composure" unless erichs thought this play on words was unbelievably clever.

https://github.com/revans/bash-it/blob/master/lib/composure.sh#L18 see ''help typeset.'' (unless you're super concerned about your scripts being portable to ksh...wot)

https://github.com/revans/bash-it/blob/master/lib/composure.sh#L57
shopt -s nocaseglob case $input in (y[es]*) ...;; (n[o]) ... ;; esac

https://github.com/revans/bash-it/blob/master/lib/composure.sh#L143
greybot β”‚ basename(1) can strip the directory and extension from a path (a/b/c.d -> c.d or c). A parameter expansion can do it cleaner and much faster: "${path##/}", "${path%.}"
** you should probably replace every occurence of the triply expensive pipe to sed with a parameter expansion.

greybot β”‚ Use pgrep instead of ps to get PIDs. It saves you from having to parse output that wasn't meant to be parsed. However, finding a process by its name is unsafe. Please look at http://mywiki.wooledge.org/ProcessManagement
****** please note the comment "it saves you from having to parse output ----that wasn't meant to be parsed----"

uhmmmm, wtf is this https://github.com/revans/bash-it/blob/master/bash_it.sh#L13
the backticks create an expensive subshell in the first place. and in that subshell, you launch a THIRD bash instance just to ''echo $BASH'' and this whole construct is 100% equivalent to "var=$BASH" exactly like you have in the line before. even worse though, is that BASH is set by default already and you've just been wasting these cpu cycles for god knows how long. see ''declare -p BASH'' in a shell that isn't running bash-it.

okay, i will just leave it here. if you fix all of these problems, you'd have solved about 60% of the issues that will crop up over time due to the horrible syntactic constructs employed herein.

New "color framework" breaks text color

Apparently, the new color framework introduced in 1da06a4 and 879d540 end up making all the normal text entered into and displayed by the shell appear "bold" (eg. apparently using the wrong escape code, or simply not resetting colors).

Things are fine in previous revisions. (I tested 54ffcc0.)

fasd fails with comma decimal separator

fasd (e.g. running z Documents) fails on my OS X machine with the following error:

-bash: cd: ,002    /Users/foo/Documents/Projects/FooBarDocuments: No such file or directory
1,16226    /Users/foo/Documents/Projects/Foo Dir
2,09207    /Users/foo/Documents/Projects/..
3,645      /Users/foo/Documents/Projects/foo_framework/02_Requirements
23,2452    /Users/foo/Documents/Projects/barDocuments/01_Documentation
28,9264    /Users/foo/Documents/Projects
42,8244    /Users/foo/Documents/Projects/foo_framework
368,002    /Users/foo/Documents/Projects/FooBarDocuments

I think this is due to my account using a German locale, where the comma is used as the decimal separator.

I've seen in the fasd.plugin.bash file that AWK is used for doing the calculations, and it looks like AWK is using the comma in this case. If I execute the following command, I end up with a result of 1,5:

awk "BEGIN{ print 3/2 }"

The code in fasd uses this to populate the "database", but while parsing, it looks for a point (.) as the decimal separator and thus fails.

@erichs Is that something you can look into?

Let me know if you need more info.

Support symbolic links in enabler directories

I think it would be useful to be able to enable plugins / aliases / completion etc. by just creating a symbolic link in the proper directory.

That way, we won't need more work to update it after a git pull.

file not found error when loading

Here is the error I get when loading bash-it for the first time:

bash: /home/jryan/.bash_it/bash_it.sh: No such file or directory

I tried chasing it down and the only thing I can find that seems out of place is a broken symlink in the bash-it folder .bash_it

Which it seems from some of the code that file should be in my home directory helping with the configuration. I'm not a bash guru far fro it actually but I can't figure this out. Maybe someone else is experiencing this as well.

Thanks

Constant Spam

For some reason, whenever I run ANY command, I get this:

/home/neer/.z.tmp' ->/home/neer/.z'

Without fail, no matter if I run a script, a command, or a perl-one-liner, I always get this message.
Does anyone know how to fix it?

.rvmrc could not load

Issue occurs when you go into folder that contains .rvmrc file (rvm script file). It should load the script file first but it don't

Broken History

One of the last changes broke the bash history.
The characters start flipping around and it's hard to read or edit a recently executed command.

Won't install or run on my linux x64 (ubuntu)

When I run the install script it runs through four options then exits. It doesn't seem to of put itself on my PATH at all though and when I run the bash-it.sh script directly i get an error. Here's what I did and the output I got:

image

It looks like it is trying to use some global files so I ran the install script again as admin to see if it would install correctly but no diff.

SCP transfrer break when enabling bash-it

If i enable bash it and make my .bashrc a link to .bash_profile whenever I try to do an SCP transfer instead of transferring the file it echos out the last directory used.

Workflow for multiple Jekyll sites

@mrman208 I'm interested to get your input on how you use bash-it with multiple Jekyll sites. From what I can tell, the aliases and plugins are designed to work with one site, that points to $JEKYLL_LOCAL_ROOT.

Personally, I use Jekyll for several projects and I'm curious if others would be interested in modifying this.

Bash-it got really slow on Mountain Lion

Hi, after upgrading to Mountain Lion I've noticed that opening Terminal became considerably slower. Is there anything I can do to make it more snappier again?

bash-it help completions not a valid option

README.md lists the help screens available, but 'bash-it help completions' throws the following error:

oops! completions is not a valid option!

even tried 'bash-it help completion general' to show completions for the 'general' completion, but throws same error.

color errors

When I'm typing "myip", I'm getting (I've replaced the actual ip address with 123.123.123.123):

Your public IP is: [\e[1;32m] 123.123.123.123 [\e[00m]

instead of the colored ip.

Prompt command display error

Whenever my prompt loads it's duplicating the display of the last command like:

Last login: Mon Mar  5 08:50:56 on ttys003
\e]0;[email protected] ~ 
farneman[~]
β‰  Β» cd .bash_it
\e]0;cd .bash_it {~} ([email protected])\e]0;[email protected] ~/.bash_it 

The "farneman[~] β‰  Β»" part is my prompt.

I'm using iTerm2 on an iMac running OS X 10.6. The problem occurs no matter what theme being used. I've tried install bash_it with none of the plugins, completion or aliases installed and the issue persists. I'm using the exact same setup on an older G5 PowerMac running OS X 10.5 and the problem doesn't occur on that machine.

Any idea what may be causing this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.