Advertisement
rabirajkhadka

Untitled

Dec 22nd, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. val=`expr 786 + 240`
  4. echo "Sum of 240 and 786: $val"
  5. one= 786
  6. two= 240
  7. `expr $one + $two`
  8. `expr $one - $two`
  9. `expr $one \* $two`
  10. `expr $one / $two`
  11. [ $one == $two ]
  12. [ $one -eq $two ]
  13. [ $one -ne $two ]
  14. [ $one -gt $two ]
  15. [ $one -lt $two ]
  16. [ $one -ge $two ]
  17. [ $one -le $two ]
  18.  
  19. _______________________________________
  20. #!/bin/sh
  21.  
  22. for i in 1 2 3 4 5
  23. do
  24. echo "Looping ... number $i"
  25. done
  26. _______________________________________
  27.  
  28. #!/bin/sh
  29. INPUT_STRING=hello
  30. while [ "$INPUT_STRING" != "bye" ]
  31. do
  32. echo "Please type something in (bye to quit)"
  33. read INPUT_STRING
  34. echo "You typed: $INPUT_STRING"
  35. done
  36.  
  37. _________________________________________________
  38. #!/bin/sh
  39.  
  40. echo "Please talk to me ..."
  41. while :
  42. do
  43. read INPUT_STRING
  44. case $INPUT_STRING in
  45. hello)
  46. echo "Hello yourself!"
  47. ;;
  48. bye)
  49. echo "See you again!"
  50. break
  51. ;;
  52. *)
  53. echo "Sorry, I don't understand"
  54. ;;
  55. esac
  56. done
  57. echo
  58. echo "That's all folks!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement