如何保持报价在args? [英] How to keep quotes in args?

查看:145
本文介绍了如何保持报价在args?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Bash脚本,我想保持在传递的参数报价。

例如:

  ./ test.sh这是一些测试

然后我想用这些参数,并重新使用它们,包括围绕整个参数列表报价及报价。

我试着用 \\$ @ \\,但删除列表内的报价。

我如何做到这一点?


解决方案

  ./ test.sh这是'一些测试'

I have a Bash script where I want to keep quotes in the arguments passed.

Example:

./test.sh this is "some test"

then I want to use those arguments, and re-use them, including quotes and quotes around the whole argument list.

I tried using \"$@\", but that removes the quotes inside the list.

How do I accomplish this?

解决方案

./test.sh this is '"some test"'

这篇关于如何保持报价在args?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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