使用单个命令行Java进行编译和构建(Linux) [英] Compile and build with single command line Java (Linux)
本文介绍了使用单个命令行Java进行编译和构建(Linux)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以通过这种方式设置别名,以便我可以输入命令,然后在一行中输入参数?
Is there way to set up an alias in such a way so that I could enter the command, followed by the argument in a single line?
例如,代替
javac Program.java && java Program
我可以去
newcommand Program.java //or "newcommand Program", whichever is easier
将执行与上一行相同的命令.
which would do the same commands as the line above.
推荐答案
alias
不能接受参数,请定义如下函数:
An alias
is not made to accept parameters, define a function like this:
jcar() { javac $1.java && java $1 ; }
然后使用它:
jcar Program
(jcar
旨在作为java-compile-and-run的首字母缩写)
(jcar
was intended as an acronym for java-compile-and-run)
这篇关于使用单个命令行Java进行编译和构建(Linux)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文