String concatenation and if-fi constructs in bash fail

Borislav Tomov bt@oersted.dtu.dk
Thu Nov 9 11:32:00 GMT 2006


I am observing that string concatenation in bash 3.2.3(5), as well as in 
3.1.17 (not exactly sure, the one that comes with the distribution), 
overwrites the first string variable during concatenation:

Example code:

string1="one"
string2="two"
echo $string1
echo "$string1+"
echo "$string1+$string2"
echo "The number 2: $string2"
echo "This is $string1 + $string2"

Example results:

one
+ne
+two
The number 2: two
 + twos one

-------------------------------------------------------------------------------------
Adding an if-fi construction in the bash script leads to an error:

Example:

if $x==5; then
     echo "Blah1"
    else
     echo "Blah2"
    fi

Example result:
       
        for line XX which is the last +1 line of the script, the 
following message is displayed

script_path: line XX: syntax error: unexpected end of file

Cheers,
   Borislav


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20061109/43e2b738/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list