dridk dridk - 1 year ago 93
Java Question

replace java -jar by a bash command line

It's boring to run java commande using java -jar arg1 arg2 ..
Is there a way to create a standard command line easily from a script file, without alias ?

For instance using /usr/bin/trimmomatic to replace

java -jar /PROGS/EXTERN/trimmomatic-0.35.jar MYFILE


trimmomatic MYFILE

Answer Source

You can append the following to your ~/.bashrc file:

alias trimmomatic='java -jar /PROGS/EXTERN/trimmomatic-0.35.jar'

Then restart your shell (or do source ~/.bashrc if you don't want to restart it) and the alias should be available.

Alternatively, you can define a bash function (e.g. in your ~/.bashrc again):

trimmomatic() { java -jar /PROGS/EXTERN/trimmomatic-0.35.jar "$@"; }

or a wrapper shell script that you can put in you $PATH:

java -jar /PROGS/EXTERN/trimmomatic-0.35.jar "$@"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download