Advertisement
metalx1000

Global and Local Variables

Nov 7th, 2015
665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.20 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. x=20
  4. myfun(){
  5.   echo "Global x is $x"
  6.   local x=10;
  7.   echo "local x is $x"
  8. }
  9.  
  10. echo "x out side of funtion is $x - Global x"
  11. myfun
  12. echo "x out side of funtion is $x - Global x"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement