String concate problem

Hello there,

I am facing the following problem in string concate.

I am returning a sql column value to a shell script variable .
Now when I am trying to concate the variable with another string (string appears first)
I am getting a space between the two concate.

Example p is the shell variable which takes the value of a column value say 9666
now when I try q = '+'$p I am getting + 9666 (a space between + and 966) instead of +9666

Please help me to resolve the situation

I think there is new line appending because when I run the command
echo "$q"|sed 's/ //g'
I found the o/p as
+
9666

This should work with any number of leading or trailing spaces.

q='+'$(echo $p)

Thanks a lot :slight_smile:
It works!!!!!!!!!!!!!