Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

20.12. Functions

例 20.7. Functions with parameters sample

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

e Hello
e World
quit
echo foo			
			
			

20.12.1. Local variables

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