Issue
This is a "fun" question with some level of serious application. I like chav lingo and I was thinking it would be pretty cool to run npm innit
instead of npm init
. I know broadly npm allows aliases through package.json (eg when you run scripts) eg npm run innit
would be trivial. however that's not really what I'm going for. I want to alias npm innit
to npm init
. just wondering if theres a way. i've looked through npm help
as well as .bash_profile alias
instructions on macosx but they dont really allow for space-separated aliases...
please let me know if you have any ideas. would help me learn aliasing more generally too.
thank you.
Solution
From the Bash Reference Manual:
If the last character of the alias value is a blank, then the next command word following the alias is also checked for alias expansion.
So you can do this:
alias npm='npm ' # The trailing space is important
alias innit='init'
Answered By - Sean Bright Answer Checked By - Robin (WPSolving Admin)