假设我们将变量'a'设置为12345:
set a 12345
Run Code Online (Sandbox Code Playgroud)
现在我如何设置一个新变量'b',其中包含'a'的值和另一个字符串9876
解决方法就像是
set a "12345"
set u "9876"
set b $a$u
Run Code Online (Sandbox Code Playgroud)
但我不想指定,$u而是我想要使用直接字符串..
Tre*_*son 35
你可以做:
set b ${a}9876
Run Code Online (Sandbox Code Playgroud)
或者,假设b设置为空字符串或未定义:
append b $a 9876
Run Code Online (Sandbox Code Playgroud)
长时间的呼叫append效率更高$a(参见appenddoc).