flag/argument in bash alias
I think you are looking for functions.
function add() {
local name="$1"
java -jar vc.jar "${name}"
}
Add this to your ~/.bashrc
or ~/.profile
and just call like this;
user@host$ add samplename
Alternatively you can trigger an alias expansion by adding a space or tab character at the end of the alias definition.
alias add='java -jar vc.jar '
(Note the space at the end of definition).
Then just call it normally;
user@host$ add samplename
It should work.
EDIT: As pointed out by @kusalananda you can omit the space and it will still work just fine.
You can try to remove the name
flag and set an alias for java -jar vc.jar
.
What you want to do:
alias add="java -jar vc.jar"
You now have set an alias. To run it:
add nameofsomethingyouwant
You could also try it with @cevhyruz's solution, but I think this one is simpler.