I have a file config.ini:repo_path=ssh://git@localhost:10022/root/dir_path=/home/vagrant/workspace/and a 'script.sh' to export and concatenate from that file as follow:while read -r line; do export $line; done <config.inirepo_name=$1repo_path=$repo_path$repo_name'.git'dir_path=$dir_path/$repo_nameecho $repo_pathecho $dir_pathso when i run the script: ./script.sh sampleoutput:sample.gitlocalhost:10022/root//sampleagrant/workspace/expected output:ssh://git@localhost:10022/root/sample.git/home/vagrant/workspace/sample
concatenate string in shell
bash;shell script
A plausible explanation is that you have an embedded carriage return in your data.sample.gitlocalhost:10022/root/^^^^^^^^^^That is to say the string is the following (using C language string literal notation):ssh://git@localhost:10022/root/\rsample.gitNote the \r denoting a carriage returnWhen you send this to the terminal, the carriage return causes the cursor to move to the beginning of the line, so that sample.git overwrites the ssh://... prefix.To debug this sort of mysterious output problem, you can pipe the output of the command to a binary dump utility like od:echo $strange | od -t c  # see characters with backslash notation, or -t x1 for hex