Home | 簡體中文 | 繁體中文 | 雜文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 作品與服務 | Email

22.6. Functions

例 22.7. Functions with parameters sample

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

22.6.1. Local variables

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