shantanuo
shantanuo

Reputation: 32316

Append variable in shell

The following code does not output "hello world" I do not want to use standard out unless I have to.

#!/bin/sh

message="hello "
message.="world"

echo $message

Upvotes: 0

Views: 879

Answers (2)

redoc
redoc

Reputation: 156

the following works:

#!/bin/sh

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

echo $message

Upvotes: 0

onteria_
onteria_

Reputation: 70497

You can use variable expansion to achieve this:

#!/bin/sh

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

echo $message

Upvotes: 4

Related Questions