views:

65

answers:

2

how do you define a variable to an integer at the command line. For example if i want to assign A=22 and B=23 and then have the A and B = a separate variable such as C..? I am confused on the syntax of this at the command line. I understand how to set variables in a script but how would i do it from a command line using only 1 line? Any hints are appreciated.

A: 
A=22; B=23; ((C=A+B)); echo $A $B $C

Assuming Bash or Korn shell.

Jonathan Leffler
A: 

set A=22 set B=23 set A=%C% set B=%C%

In windows bat-files. Also be careful not to use any extra spaces in batch file syntax. It can screw up everything.

AareP