I used to use CShell (csh), which lets you make an alias that takes a parameter. The notation was something like
alias junk=\"mv \\\\!* ~/.Trash\"
If you're looking for a generic way to apply all params to a function, not just one or two or some other hardcoded amount, you can do that this way:
#!/usr/bin/env bash
# you would want to `source` this file, maybe in your .bash_profile?
function runjar_fn(){
java -jar myjar.jar "$@";
}
alias runjar=runjar_fn;
So in the example above, i pass all parameters from when i run runjar
to the alias.
For example, if i did runjar hi there
it would end up actually running java -jar myjar.jar hi there
. If i did runjar one two three
it would run java -jar myjar.jar one two three
.
I like this $@
- based solution because it works with any number of params.