gpt4 book ai didi

linux - 使用选项 -c 在 shell 脚本中打印单引号

转载 作者:太空狗 更新时间:2023-10-29 12:10:21 24 4
gpt4 key购买 nike

<分区>

这听起来可能是新手,但我已尽一切努力让它发挥作用。我想用单引号打印一个词:'John' 在 shell 脚本中。我无法替换 /bin/bash -l -c,因为这部分代码由 Java 运行,我必须将 shell 命令作为字符串传递。我也尝试使用 echo -e 选项。

/bin/bash -l -c 'echo "'John'"'

我想要的输出是:

'John'

我尝试转义单引号,但到目前为止没有任何帮助。有什么想法吗?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com