When i'm trying to execute following line of code
#!/bin/sh
a=20
b=10
sum=`expr $a + $b` #(i thought i did wrong with ` so i put (') also to check but its becomes literals which gets printed as usual)
echo $sum
i'm getting the error
expr: non-integer argument
Can someone tell me where it went wrong in this code because almost on every tutorial same thing was mentioned to do Arithmetic in Shell Script.
Edit: for those whose working i'm using CYGWIN terminal FYI. IS there any difference ?
Edit 2 : As mentioned in the comment by @ghoti Windows file ends with /r/n while unix ends with /n .. Since i'm writing my Script in windows platform while executing in Unix Platform , So when i'm removing back-tick its giving me error
$'20\r': command not found
so definitely $a is changed into 20 but \r is resulting into error. So any ideas how to Short out this error ?