Home | Mirror | Search

7. Functions

例 2.7. Functions with parameters sample

#!/bin/bash
function quit {
   exit
}
function e {
    echo $1
}
e Hello
e World
quit
echo foo
		

7.1. Local variables

 #!/bin/bash
	HELLO=Hello
	function hello {
	        local HELLO=World
	        echo $HELLO
	}
	echo $HELLO
	hello
	echo $HELLO
		
comments powered by Disqus