0

I would like to create a parameterized bash alias. I am not certain that is the correct way to describe it.

For example:

alias gps="gulp protractor --specs=test/browser/specs/<i-want-to-parameterize-this-bit>.js"

So that I can type:

gps foo/bar

...and the command resovles to:

alias gps="gulp protractor --specs=test/browser/specs/foo/bar.js"

How can I do this?

Ben Aston
  • 53,718
  • 65
  • 205
  • 331

1 Answers1

0

Use a shell function:

gdiff() { 
   git diff --color=always "$@" | less -r
}

Another example:

foo() { /path/to/command "$@" ;}
foo arg1 arg2

You can create script, and pass arg.

chepner
  • 497,756
  • 71
  • 530
  • 681
Noproblem
  • 745
  • 1
  • 6
  • 15