Slight issue with enable-plugin #136

ajy opened this Issue May 18, 2012 · 7 comments


None yet
3 participants

ajy commented May 18, 2012

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


tswicegood commented May 18, 2012

Paging @erichs (since he's the one who implemented this).

@ajaygavankar What is your $TERM variable set to? I just disabled and re-enabled dirs on my system with no problem.


erichs commented May 18, 2012

Interesting. For reference, here's the code in question:

    if [ "$1" = "all" ]; then
        typeset f plugin;
        for f in $BASH_IT/plugins/available/*.bash;
            plugin=$(basename $f);
            if [ ! -h $BASH_IT/plugins/enabled/$plugin ]; then
                ln -s $BASH_IT/plugins/available/$plugin $BASH_IT/plugins/enabled/$plugin;
        typeset plugin=$(ls $BASH_IT/plugins/available/$1.*bash 2>/dev/null | head -1);
        if [ -z "$plugin" ]; then
            printf '%s\n' 'sorry, that does not appear to be an available plugin.';
        plugin=$(basename $plugin);
        if [ -e $BASH_IT/plugins/enabled/$plugin ]; then
            printf '%s\n' "$1 is already enabled.";
        ln -s $BASH_IT/plugins/available/$plugin $BASH_IT/plugins/enabled/$plugin;

@ajaygavankar, when you do this:

plugin=$(ls $BASH_IT/plugins/available/$target.*bash 2>/dev/null | head -1)
echo "XXX${plugin}XXX"

what do you see?

ajy commented May 19, 2012

thanks for the quick reply
@tswicegood my $TERM is set to xterm
@erichs running your code gives me this-

have tried more stuff, enabling all plugins works perfectly, except for the clash between fasd and z.

and inserting these statements
echo $plugin echo $BASH_IT/plugins/available/$plugin echo $BASH_IT/plugins/enabled/$plugin
just before the ln command gives this when i try to enable dirs


which looks right, so i'm guessing the ln command is screwing up somehow, but typing out the ln command in the terminal creates the symlink perfectly and enables the plugin.

weirdest thing i have ever seen


erichs commented May 19, 2012

Assuming you've tried closing your terminal and re-opening it?

"?[0m" is likely an ANSI escape sequence gone astray. What theme and prompt code are you using?

Also, what happens if you:

$ rm -rf $BASH_IT/plugins/enabled
$ mkdir $BASH_IT/plugins/enabled
$ enable-plugin base
$ ls -l $BASH_IT/plugins/enabled

ajy commented May 20, 2012

yeah tried closing the terminal and re-opening it.
I'm using the zork theme.
The output of those commands is:
total 0
lrwxrwxrwx 1 aj aj 56 May 20 12:15 "base.plugin.bash?[0m" -> "/home/aj/.bash_it/plugins/available/base.plugin.bash?[0m"

with the things in quotes getting highlighted red in my solarized terminal, which i think means the symlink is broken


erichs commented May 20, 2012

Ok, thanks!

Try changing your theme. Does that help?

Try replacing this line:

typeset plugin=$(ls $BASH_IT/plugins/available/$1.*bash 2>/dev/null | head -1)

with this:

typeset plugin=$(ls $BASH_IT/plugins/available/$1.plugin.bash 2>/dev/null | head -1)

does that work?

If not, try replacing it with this:

typeset plugin=$(command ls $BASH_IT/plugins/available/$1.*bash 2>/dev/null | head -1)

If any of those suggestions fix your issue, I'd like to know which.

ajy commented May 20, 2012

Hey, thanks for figuring it out, the last one did the trick .i.e.

typeset plugin=$(command ls $BASH_IT/plugins/available/$1.*bash 2>/dev/null | head -1)

Works for all the plugins above that didn't work before

@ajy ajy closed this May 20, 2012

erichs added a commit to erichs/bash-it that referenced this issue May 20, 2012

fix for issue #136
issue #136 was found to be caused by an aliased 'ls' command that
generated rogue values for 'plugin' in the enable/disable-plugin()
functions. this commit fixes that by forcing the shell to disregard
aliased 'ls' commands.

tswicegood added a commit that referenced this issue May 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment