0

I want to make an alias for the rbt command. I thought it should be:

alias myrbt 'rbt \!:1 --server=myserver --repository-url=myurl \!:2- \!:$'

the expected result is when I run

myrbt diff 12345

it should run

rbt diff --server=myserver --repository-url=myurl 12345

when I run

myrbt post 1.py 2.py

it should run

rbt post --server=myserver --repository-url=myurl 1.py 2.py

...but it doesn't work.

Shuman
  • 3,914
  • 8
  • 42
  • 65

1 Answers1

1

I think this is what you're looking for?

# Replace `echo` with `rbt`
$ alias myrbt 'echo \!:1 --server=myserver --repository-url=myurl \!:2*'

$ myrbt diff 12345
post --server=myserver --repository-url=myurl 12345

$ myrbt post 1.py 2.py
post --server=myserver --repository-url=myurl 1.py 2.py

The reason your version doesn't work is that with \!:2- doesn't seem to work if there are only two parameters (there need to be at least three).

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146