#!/bin/bash x=20 myfun(){ echo "Global x is $x" local x=10; echo "local x is $x" } echo "x out side of funtion is $x - Global x" myfun echo "x out side of funtion is $x - Global x"