aquaballoon

sh - function

Dec 2nd, 2011
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.26 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. read -p "fisrt:  " x
  4. read -p "second:  " y
  5.  
  6. plus ( )
  7. { expr $x + $y
  8. }
  9.  
  10. minus ( )
  11. { expr $x - $y
  12. }
  13.  
  14. read -p "choose the operation; + -  " out
  15.  
  16. case $out in
  17. +)
  18. echo "total is: `plus $x $y`" ;;
  19. -)
  20. echo "total is: `minus $x $y`" ;;
  21. esac
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment