I'd like to have a file eg. f with only zsh aliases (pureness reasons). Then I'd like to include f file in my .zshrc file, so that the aliases defined in f are visible in .zshrc.
Is it possible?
If it is, I could create a script eg. my_alias
($my_alias ll 'ls -l'
) which appends alias to f file.
Of course I could do
$echo {alias command} >> ~/.zshrc
but this makes .zshrc one big mess.
Additionally how is it looks like in bash?
UPDATE
If someone share my idea this is solution, thanks to phunehehe:
# source aliases
ALIASFILE=~/.aliasesrc
source $ALIASFILE
function add_alias() {
if [[ -z $1 || -z $2 || $# -gt 2 ]]; then
echo usage:
echo "\t\$$0 ll 'ls -l'"
else
echo "alias $1='$2'" >> $ALIASFILE
echo "alias ADDED to $ALIASFILE"
fi
}