Last active
August 29, 2015 14:17
-
-
Save randomessence/16dd9145785a7c36dec6 to your computer and use it in GitHub Desktop.
variable expansion
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
# Make the test folder we will work in. | |
mkdir -p ~/mytest && cd ~/mytest | |
# Export the test variables. | |
export testvar1="000 111 222 333 444" && export testvar2="555 666 777 888 999" | |
# create a folder using command or paramter substitution and testvar1 | |
mkdir $(echo $testvar1) && ls | |
mkdir ${testvar1} && ls | |
mkdir $testvar1 && ls | |
# Result = 5 separate folders | |
# create a folder using command or paramter substitution and testvar2 | |
mkdir "$(echo $testvar2)" && ls | |
mkdir "${testvar2}" && ls | |
mkdir "$testvar2" && ls | |
# Result = 1 folder with a 5 part name | |
# reset folder. | |
rm -rf ~/mytest/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment