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
  • 49,455
  • 61
  • 188
  • 322

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
  • 446,329
  • 63
  • 468
  • 610
Noproblem
  • 735
  • 1
  • 6
  • 15