Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | Email

1.6. Functions

例 1.7. Functions with parameters sample

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

1.6.1. Local variables

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