Home arrow Shell Programming arrow Adding Two Numbers Using UNIX Shell Scripting Language
Adding Two Numbers Using UNIX Shell Scripting Language PDF
Saturday, 23 January 2010
To add two numbers we can pipe an echo to the bc app from a shell script:

Example of adding two numbers
  1. #!/bin/sh
  2.  
  3. a=10
  4. b=20
  5. c=`echo $a+$b | bc`
  6. echo "c="$c

 

 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?