【问题标题】:How to use the variable in gnome-terminal command如何在 gnome-terminal 命令中使用变量
【发布时间】:2018-09-13 11:37:43
【问题描述】:

我试图在 gnome-terminal 命令中回显一个变量

gnome-terminal -e 'sh -c "echo $1"'

我按照以下链接获取命令

Link to the answer

我没有在终端上得到任何东西,这里的变量如何使用?

【问题讨论】:

  • 你找到答案了吗?

标签: gnome-terminal


【解决方案1】:

在单引号内,所有内容都按字面意思保留,无一例外。

这意味着你必须关闭引号,插入一些东西,然后像这样重新输入。

cmd -arg 'cmd before'${variable}'cmd after'

所以你的情况是:

gnome-terminal -e 'sh -c "echo '${1}'"'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-30
    • 1970-01-01
    • 2019-12-13
    相关资源
    最近更新 更多