Skip to content

Instantly share code, notes, and snippets.

@YakDriver
Last active February 9, 2018 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YakDriver/c9f9bcd1c0198ba58fa701c6b647a335 to your computer and use it in GitHub Desktop.
Save YakDriver/c9f9bcd1c0198ba58fa701c6b647a335 to your computer and use it in GitHub Desktop.
Bash Basics: Global variables
#!/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