带有空格的Apache CLI选项值 [英] Apache CLI option value with whitespace
本文介绍了带有空格的Apache CLI选项值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Apache CLI来解析命令行参数。我的一个参数是一个过滤器,它接受一个字符串 MyApp -f搜索这个字符串
当我做 cmdLine.getOptionValue(f)
它会返回:搜索这个字符串
但是它只是返回 search
我在ubuntu上。
div class =h2_lin>解决方案我认为传递带有额外单引号的字符串应该可以工作:
MyApp -f'搜索此字符串'
I'm using Apache CLI to parse command line arguments. One of my arguments is a filter that takes a string MyApp -f "search for this string"
I thought when i do cmdLine.getOptionValue("f")
it would return: search for this string
However it just returns search
What should I do to ensure that the entire string is retrieved, apparently just wrapping it in double quotes doesn't seem to work.
I'm on ubuntu.
解决方案
I think passing the string with extra single quotes should work:
MyApp -f "'search for this string'"
这篇关于带有空格的Apache CLI选项值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文