2011-05-12 77 views
0

以下代碼不會輸出「hello world」 我不想使用標準輸出,除非必須輸入。在shell中添加變量

#!/bin/sh 

message="hello " 
message.="world" 

echo $message 

回答

4

您可以使用變量擴展來實現這一目標:

#!/bin/sh 

message="hello " 
message="${message}world" 

echo $message 
0

了以下工作:

#!/bin/sh 

message="hello " 
message="$message world" 

echo $message