简体   繁体   English

Bash 的“别名”命令和 .bashrc 内容不同

[英]Bash's "alias" command and .bashrc contents differ

I added an alias to ~/.bashrc like below:我为~/.bashrc添加了一个别名,如下所示:

alias jetty_home=”java -jar ~/path/to/libexec/start.jar”

If I try to execute source ~/.bashrc it prints如果我尝试执行source ~/.bashrc它会打印

alias: -jar: not found  
alias: /path/to/libexec/start.jar": not found

When I call alias the output is:当我调用alias时,output 是:
alias jetty_home='"java'

and for jetty_home the output is:对于jetty_home ,output 是:
"java: command not found

Obviously I'm messing up with spaces and escaping here.显然我在这里搞砸了空格和 escaping 。 What's the correct way to do this?这样做的正确方法是什么?

Try switching the alias out with alias jetty_home='java -jar ~/path/to/libexec/start.jar'尝试使用alias jetty_home='java -jar ~/path/to/libexec/start.jar'切换别名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM