简体   繁体   English

按下Enter键时,阻止Linux Terminal转到新行

[英]Stop Linux Terminal from going to new line when pressing enter

I'm working on a simple Java cypher program. 我正在研究一个简单的Java密码程序。 That's why there are strange characters. 这就是为什么会有奇怪的角色。

I'm attempting to run this command in my Linux Terminal: 我正在尝试在Linux终端中运行以下命令:

user@Ubuntu> java code d ÖÝßÛ³eb©«åãá⡧ÌÚب¬Ý¢¤¤°kkicÒÒ××⥡ÏÛÛÐë`§ÞØÝßòÓ key

With this being said, When I press enter this happens: 话虽如此,当我按Enter键时,会发生以下情况:

user@Ubuntu> java code d ÖÝßÛ³eb©«åãá⡧ÌÚب¬Ý¢¤¤°kkicÒÒ××⥡ÏÛÛÐë`§ÞØÝßòÓ key
>
>
>
>

A New line appears each time I press enter. 每次按Enter键,都会出现一个新行。 How can I just run the command? 我怎样才能运行命令?

This happens because your argument contain a backtick ( ` ), which is a special shell character. 发生这种情况是因为您的参数包含反引号( ` ),这是一个特殊的shell字符。 Try putting your special characters in strong quotes: 尝试将特殊字符放在强引号中:

user@Ubuntu> java code d 'ÖÝßÛ³eb©«åãá⡧ÌÚب¬Ý¢¤¤°kkicÒÒ××⥡ÏÛÛÐë`§ÞØÝßòÓ' key

Single quotes ( ' , distinct from ` ) prevents the shell from trying to interpret your argument. 单引号( ' ,不同于` )防止shell尝试解释您的参数。

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

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