【问题标题】:how to print the Variable 'num' in my bash shell如何在我的 bash shell 中打印变量“num”
【发布时间】:2011-03-14 02:19:55
【问题描述】:

这是我的代码:

num=2
echo "this is the $numnd"

它显示:

this is the

我能做什么,

谢谢

【问题讨论】:

    标签: linux bash shell ubuntu


    【解决方案1】:

    使用大括号,如下所示:

    num=2
    echo "this is the ${num}nd"
    

    输出:

    this is the 2nd
    

    【讨论】:

      【解决方案2】:

      你可以使用:

      echo "this is the ${num}nd"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-10-06
        • 2017-01-28
        • 2022-10-21
        • 2018-10-03
        • 2014-09-19
        • 2011-12-26
        相关资源
        最近更新 更多