Skip to content

Instantly share code, notes, and snippets.

@gbarreiro
Created December 6, 2020 20:43
Show Gist options
  • Save gbarreiro/d903536303a6a1206b8ed819ac906a7d to your computer and use it in GitHub Desktop.
Save gbarreiro/d903536303a6a1206b8ed819ac906a7d to your computer and use it in GitHub Desktop.
Bash cheatsheet: variables
echo "hello" # prints hello in the console
echo $USER # prints the value of the variable USER in the console
env # prints all the environment variables
set # prints all the local variables
MY_FRIENDS=William # create a local variable called MY_FRIENDS
MY_FRIENDS=$MY_FRIENDS:John:Anna # concatenate values 'John' and 'Anna' to MY_FRIENDS
export MY_FRIENDS # makes local variable MY_FRIENDS an environment one
unset MY_FRIENDS # deletes the variable MY_FRIENDS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment