Quantcast
Channel: creativecss - aliases
Viewing all articles
Browse latest Browse all 2

Custom aliases with arguments in Linux

$
0
0

Nice and short post about creating custom aliases that can take parameters. Just a note that this example is based on my dev virtual machine and uses commands from Drush and Quickstart

So why create an alias

On my dev virtual machine I have Drush and Quickstart installed so I can run the following code to create a new drupal site drush qc --domain=mysite.local --dbuser=root --dbpassword-supersecret Now that is fine but having to enter all of that is bit of a pain so I want to just pass the --domain as that is all that changes between the sites. So I came up with putting the following in my .bashrc file.

You can locate your .bashrc file by running cd ~/.bashrc so edit it and put the following code in.

 

drushqc() {
    drush qc --domain=$1 --dbuser=root --dbpassword=BuoWKwPUw9Swys50qyWu
}
alias buildsite=drushqc

 

Once that is in your aliases file run the following command "source .bashrc" and that will reload your aliases file so the new one will take effect. So to test it just run buildsite --domain=test.local.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images