Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way in .bash_profile, to create two aliases that do the same thing?

Tags:

alias

bash

macos

I have some simple aliases in my .bash_profile (OS X El Capitan, 10.11.6). Sometimes, I want multiple aliases that do the same thing. I have, for example, a folder that is my starting point for programming projects. Currently, I have an alias for code and one for programming that do the same thing:

alias code='cd /path/to/Programming/; clear; pwd; ls'
alias programming='cd /path/to/Programming/; clear; pwd; ls'

This saves me having to remember how I aliased this directory. Is there a way to set multiple aliases without having to repeat the command? In short, is there something like this?

alias code,programming='cd /path/to/Programming/; clear; pwd; ls'
like image 812
jamesnotjim Avatar asked Oct 30 '18 17:10

jamesnotjim


1 Answers

In short, is there something like this?

alias code,programming='cd /path/to/Programming/; clear; pwd; ls'

Yes, brace expansion:

alias {code,programming}='cd /path/to/Programming/; clear; pwd; ls'
like image 178
that other guy Avatar answered Sep 22 '22 12:09

that other guy