Created
January 10, 2012 13:16
-
-
Save ehabkost/1589039 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo inc.sh: | |
if [ "${#BASH_SOURCE[@]}" -le 1 ];then | |
echo I am the main script file. | |
else | |
echo I am being called from another file. | |
fi | |
func1() | |
{ | |
echo env on func1 called from $1: | |
set | |
echo -------- | |
} | |
echo env on inc.sh, top-level: | |
set | |
echo ---------- | |
func1 inc.sh | |
echo end of inc.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo I am mainscript.sh: | |
source inc.sh | |
echo env on mainscript.sh, top-level: | |
set | |
echo ----------- | |
func1 mainscript.sh | |
echo end of mainscript.sh. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output of revision 4e5932: