Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | 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