Doing additions in cygwin?

Thrall, Bryan bryan.thrall@flightsafety.com
Thu Mar 22 20:15:00 GMT 2007


Kevin Markle wrote on Thursday, March 22, 2007 2:49 PM:
> Hello,
> 
> I'm attemping to use the expr variable and am having problems. when I
> type test=expr 1+1 or
> test=`expr 1+1` or
> test='expr 1 + 1' or
> 
> with and without quotes?? I just want to create a variable based on
> and expression?

(1) You didn't really describe what problems you're seeing (I think I
know what they are, though).

(2) expr wants separate arguments, like "expr 1 + 1", not "expr 1+1".

(3) use backtics to get the output when you set the variable:
"test=`expr 1 + 1`", not "test='expr 1 + 1'".

(4) This isn't really Cygwin-specific, so it would be better to try "man
expr" (for how to use expr) or "man bash" (for quoting rules).

Hope this helps!
-- 
Bryan Thrall
FlightSafety International
Bryan.Thrall@flightsafety.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list