Skip to content

Instantly share code, notes, and snippets.

@YakDriver
Last active Feb 9, 2018
Embed
What would you like to do?
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