How and where to set bash alias


#1

Hi,

I have installed thefuck in my workspace, and want to set alias but failed:

I tried to add the alias setting in .bashrc and .bash_alias (which I see suggested in .bashrc), but it doesn’t work, when I type “fuck” in command, it turns out error as below:
machinefriendly:~ fuck Seems like fuck alias isn't configured! Please put eval (thefuck --alias) in your ~/.bashrc.
More details - https://github.com/nvbn/thefuck#manual-installation

hope someone could help, thanks in advance.

Best,


#2

Cloud9 aliases should work in both ~/.bashrc and ~/.bash_aliases but just to be sure, can you try adding another alias to see if that will work? Just add something simple like this:
alias newAlias="echo 'aliases work'"

Try that on both files to be sure both work.


#3

Thanks Brady for your help, yes, it works.
It turns out that, I should add following code in .bashrc or .bash_aliases:

TF_ALIAS=fuck alias fuck='eval $(thefuck $(fc -ln -1)); history -r'

which is not indicated on the package’s github page, and I got it with fuck -a;

In case someone needs more details, you may find more in this gist.

Cheers,