[英]Bash echo output mix of string and character
.
is the string concatenation operator for PHP.是 PHP 的字符串连接运算符。 In bash, you could just do
echo Tomorrow will be January ${num}rd
.在 bash 中,你可以只做
echo Tomorrow will be January ${num}rd
。
Both versions of the code output Tomorrow will be January 3rd
.两个版本的代码输出
Tomorrow will be January 3rd
。
That code looks more like PHP.该代码看起来更像 PHP。
.
is the concatenation operator, and it can be used with both strings and numbers (it will convert the number to a string).是连接运算符,它可以用于字符串和数字(它将数字转换为字符串)。 The output will be
输出将是
Tomorrow will be January 3rd
In bash
, .
在
bash
, .
has no special meaning, so it will be echoed literally.没有什么特别的意思,所以会从字面上呼应。 The
echo
command puts a space between each argument, so the output will be echo
命令在每个参数之间放置一个空格,因此输出将是
Tomorrow . will be January . 3 . rd
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.