1

I am losing my mind here.. have tried every combination of functions that strip whitespace but I can't get rid of this particular whitespace

I want to write a convenience alias so that typing

runit cmd arg

results in

php artisan runit:cmd arg

I have tried all of these

alias runit="php artisan runit:${1}"
alias runit="php artisan runit:${@}"
alias runit="php artisan runit:${1} ${@:2}"
alias runit="php artisan runit:${1:1:${#1}-2}"

And I've tried many other ways to basically strip the whitespace that is always added in between the runit: and my passed first argument

The end result no matter what I've tried is

php artisan runit: cmd arg

Cannot for the life of me get rid of the space between "runit:" and a CLI argument. I've tried assigning ${1} to another variable first, can't get rid of that leading whitespace..

Hope someone can help!

  • 3
    See https://unix.stackexchange.com/q/30925/117549 – Jeff Schaller Apr 14 '19 at 16:43
  • 3
    yea thanks for that.. I got it working immediately by using a function. I guess I was trying to keep it as simple as possible. I guess you can use some bash functionalities inside aliases such as capturing the command line arguments but a lot of other things you can't do – vesperknight Apr 14 '19 at 17:33

0 Answers0