Posts Tagged ‘BASH’

Passing parameters for BASH alias

I find it annoying to type routine long commands at shell, specially during my development work. But some of the commands requires custom parameters to be entered according to the software I am building. So I wanted to find a way to pass parameters to aliases that I will be defining. Here is what I found by searching through Google which worked for me.

m () { command $1; }

alias a= m

So at BASH when I enter

$ a test

“command test” will be executed.

Here is one such maven build command I have defined.

fb () { mvn clean install -Dproduct=$1; }

alias bp=fb

$ bp bam

will get executed as

$ mvn clean install -Dproduct=bam

Read Full Post »