TechVolcano
TechVolcano

Reputation: 231

Single echo statement displaying values in 2 lines

The echo statement below is displaying values in 2 line instead of single line (Redirect File).

echo ">>"`date`": Value1: " $VAL1 "Value2:" $VAL2>>$RES_FILE

Actual Result:

>>Tue Dec 1 10:20:24 IST 2015: Value1:1 
Value2:2

Expected Result:

>>Tue Dec 1 10:20:24 IST 2015: Value1:1 Value2:2

Tell me whats wrong with the statement.

Upvotes: 0

Views: 54

Answers (1)

P.P
P.P

Reputation: 121357

There's no problem with your usage of echo. From your output, it looks like there's a newline in VAL1.

You try removing it:

VAL1="${VAL1//$'\n'}"

Upvotes: 4

Related Questions