0

I'm in trouble... I'm just triying to concatenate two strings in a bash/shell script with the code below :

#!/bin/bash
a="me voilà"
b=" ici"
echo "$a$b}"

It must be return: "me voilà ici" But actually it returns : " icioilà"

I cannot understand why... by the way i'm on linux for windows..

Can someone help me ?

  • Update: just using command dos2unix to convert my file before execute it ( because i'm on windows and there are DOS caracters in my file) solve the problem !

Thanks.

Lye
  • 15
  • 3
  • You have DOS newlines. These contain a carriage return, which sends the cursor to the front of the line when printed. See `dos2unix`, or editor features to let you set the file type (in vim, the command `:set fileformat=unix` will do the trick). – Charles Duffy Jun 18 '21 at 19:23

0 Answers0