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 " Link to comment https://forums.phpfreaks.com/topic/256151-cygwin-bash-r/ Share on other sites More sharing options...
thehippy Posted February 1, 2012 Share Posted February 1, 2012 IIRC ttl_height = $(( $height + 80 )) Link to comment https://forums.phpfreaks.com/topic/256151-cygwin-bash-r/#findComment-1313220 Share on other sites More sharing options...
The Little Guy Posted February 1, 2012 Author Share Posted February 1, 2012 Still the same error. Link to comment https://forums.phpfreaks.com/topic/256151-cygwin-bash-r/#findComment-1313361 Share on other sites More sharing options...
kicken Posted February 1, 2012 Share Posted February 1, 2012 Try this: height=${height%%$'\x0D'} ((height+=80)) Link to comment https://forums.phpfreaks.com/topic/256151-cygwin-bash-r/#findComment-1313441 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 Link to comment https://forums.phpfreaks.com/topic/256151-cygwin-bash-r/#findComment-1313477 Share on other sites More sharing options...
kicken Posted February 1, 2012 Share Posted February 1, 2012 echo "${width}x${height}" Link to comment https://forums.phpfreaks.com/topic/256151-cygwin-bash-r/#findComment-1313488 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! Link to comment https://forums.phpfreaks.com/topic/256151-cygwin-bash-r/#findComment-1313492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.