The Little Guy Posted January 31, 2012 Share Posted January 31, 2012 I am running a bash script in Cygwin and running this: height=`identify -format "%h" $image` it returns the height of the image such as: 768 but then when I try to add 80 to that number I can't because there is a \r at the end of it. how can I add the two numbers? Full Code: cd "C:\phpDocs\images" image='Tulips.jpg' width=`identify -format "%w" $image` height=`identify -format "%h" $image` ((height+=80)) convert -size $widthx$height canvas:black new.jpg composite -compose atop -gravity south -tile logo.png new.jpg new.jpg composite -compose atop -gravity north Tulips.jpg new.jpg new.jpg Error: ")syntax error: invalid arithmetic operator (error token is " Quote Link to comment Share on other sites More sharing options...
thehippy Posted February 1, 2012 Share Posted February 1, 2012 IIRC ttl_height = $(( $height + 80 )) Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 1, 2012 Author Share Posted February 1, 2012 Still the same error. Quote Link to comment Share on other sites More sharing options...
kicken Posted February 1, 2012 Share Posted February 1, 2012 Try this: height=${height%%$'\x0D'} ((height+=80)) Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 1, 2012 Author Share Posted February 1, 2012 Try this: height=${height%%$'\x0D'} ((height+=80)) Sweet, that works! one more thing, how can I place a variable in a command? sub section of the command: $widthx$hight variables: $width, $height should display like so: 1024x848 I cant do that, because it seems to think that $widthx is the variable when it is just $width Quote Link to comment Share on other sites More sharing options...
kicken Posted February 1, 2012 Share Posted February 1, 2012 echo "${width}x${height}" Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 1, 2012 Author Share Posted February 1, 2012 Cool, Thank you so much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.