dridk dridk - 6 months ago 29
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


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 "$@"