1 다음 내용을 scope_test.sh 파일에 작성합니다.
scope_test.sh
#!/bin/bash
declared_main="beautiful" ----------------------- ①
function scope_test_func() ---------------------- ②
{
declared_in_func="hello" -------------------- ③
local func_local_var="world" ---------------- ④
echo "from inside of function" -------------- ⑤
echo " - declared_in_func => $declared_in_func"
echo " - func_local_var => $func_local_var"
echo " - declared_main => $declared_main"
echo ""
}
scope_test_func -------------------------------- ⑥
echo "from outside of function" ---------------- ⑦
echo " - declared_in_func => $declared_in_func"
echo " - func_local_var => $func_local_var"
echo " - declared_main => $declared_main"