Comment

Comment by jetpm

I made a bash function for easier alias binding. It makes aliases immediately available and permanent. Also you don't need quotes so you can use tab completion etc. It goes like this:

ali <name of alias> <command>

to get it put this in your .bashrc

  function ali() {  
   echo "alias $1='${@:2}'" >> ~/.bashrc   #in ubuntu use   ~/.bash_aliases  
   echo "made alias:";  
   echo "alias $1='${@:2}'";  
   source ~/.bashrc;  #reload bashrc  
  }

When I realize I type a command often, I just push the up arrow to get the command again, append "ali" infront of it and turn it to an alias. Works direclty.

And of course the alias to show the list of all aliases:

  alias alis='cat ~/.bash_aliases'
parent jetpm 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton