How to Add With C Shell
C Shell, or csh, is one of the command line shells for the Linux and Unix operating system. You can perform arithmetic, including addition, at the csh command line using the "expr" or "bc" commands. The "expr" evaluates an expression and prints the result to the screen. The "expr" command can evaluate both strings and numbers, while the "bc" command is a true command line calculator that only works with numbers or variables representing numbers.
Instructions
-
expr
-
1
Log into the C Shell through a terminal window or ssh session.
-
2
Type the command "expr num1 + num2." Replace num1 with the first number that you want to add. Replace num2 with the second number you want to add. For example, type "expr 100 + 200" to add the numbers 100 and 200.
-
-
3
Press the "Enter" key. The sum is displayed on the next line.
bc
-
4
Log into the C Shell through a terminal window or ssh session.
-
5
Type the command "echo 'num1 + num2' | bc." Replace num1 with the first number that you want to add. Replace num2 with the second number you want to add.
-
6
Press the "Enter" key. The sum is displayed on the next line.
-
1