Last active
February 9, 2018 19:49
-
-
Save YakDriver/c9f9bcd1c0198ba58fa701c6b647a335 to your computer and use it in GitHub Desktop.
Bash Basics: Global variables
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
#!/bin/bash | |
# Shows that global scope variables can be modified in a function. | |
# | |
# OUTPUT: | |
# | |
# 0 | |
# 5 | |
# | |
num=0 | |
change_it(){ | |
num=5 | |
} | |
echo $num | |
change_it | |
echo $num | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment