Created
December 6, 2020 20:43
-
-
Save gbarreiro/d903536303a6a1206b8ed819ac906a7d to your computer and use it in GitHub Desktop.
Bash cheatsheet: 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
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