Reputation: 249
I am using notepad++ editor and executing the shell script in Cygwin terminal.
x=5
y=6
z=`expr x + y`
echo $z
Following error is seen:
expr: non-integer argument
What is wrong with the script?
Upvotes: 0
Views: 943
Reputation: 2482
You have to dereference the variables:
z=`expr $x + $y`
Also, make sure your script has POSIX line endings (LF), not DOS-style (CRLF) line endings. (Use dos2unix
or similar to convert.)
Upvotes: 3