I want output as $msg1 two three. No space between $ and msg1. How it possible?
#!/bin/sh
msg1=$
ms="$msg1 msg1"
msg2="$ms two"
msg3="$msg2 three"
echo $msg3
I want output as $msg1 two three. No space between $ and msg1. How it possible?
#!/bin/sh
msg1=$
ms="$msg1 msg1"
msg2="$ms two"
msg3="$msg2 three"
echo $msg3
Pretty simple:
Input:
(note the single quotes)
Output:
You can use:
OUTPUT:
PS: Take note of
${msg1}
syntax to create variable boundary aroundmsg1
. This is used to avoid it making it$msg1msg1
Just quote the
$
(or also the word around it). E.g.If you want a message without newline, use
echo -n
See echo(1) and bash(1)