linuxarchlinuxaliases

how to add aliases after boot programmatically


i am creating a program to load alias sets for example i need to do some dev work i want a load of helpfull aliases but mayby in my day to day operations i dont want to have these aliases and mayby some overlap ie dev work has rm='rm -i -r' and day to day has rm='rm -r' or doesnt want an alias at all and so on i have looked at a few sorces and all say to use .bash_aliases ro .bashrc and so on but thay cant be edited by command to sum it up i want to create a command ie 'loadaliases ' and then thoses aliases be loaded and all others be removed.

im using a arch-linux system with no gui just pure console


Solution

  • Put the aliases in a file, and then when you want to enable those aliases do:

    source name_of_that_file