Jump to content

Cygwin Bash \r


The Little Guy

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.