逃避美元符号命令行参数 [英] Escape dollar sign in command line arguments

查看:109
本文介绍了逃避美元符号命令行参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过命令行传入$ 1000并通过args [0]检索字符串时,它变为000。如何在我的java代码中维护完整的字符串?

When I pass in "$1000" through the command line and retrieve the string through args[0], it becomes "000". How can I maintain the full string in my java code?

推荐答案

我猜你正在使用某种Unix系统,如'$'是bash&中的变量符号。合。尝试使用单引号(例如 java MyClass'$ 1000'

I guess you're using some kind of Unix system, as '$' is the variable symbol in bash & co. Try using single quotes (e.g. java MyClass '$1000')

这篇关于逃避美元符号命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆