I'm trying to expand variables Bash. I've searched but am not sure what the search terms are for what I am trying to do. Here is my code. Two questions:
- How do I get the desired output as shown?
- What is the Bash terminology to describe what I want here?
# Set Library install directories install_dir_1=~/Desktop/arduino-1.8.4 install_dir_2=~/Desktop/arduino-1.8.5 install_dir_3=~/Desktop/arduino-1.8.5a x=0 while [ $x -lt 4 ]; do let x=x+1 install_dir=install_dir_$x #echo $install_dir install_dir=$install_dir #echo $install_dir dir_Adafruit_SSD1306=$install_dir/libraries/Adafruit_SSD1306/ echo $dir_Adafruit_SSD1306 done
Actual output is
install_dir_1/libraries/Adafruit_SSD1306/ install_dir_2/libraries/Adafruit_SSD1306/ install_dir_3/libraries/Adafruit_SSD1306/ install_dir_4/libraries/Adafruit_SSD1306/
Desired output is
~/Desktop/arduino-1.8.4/libraries/Adafruit_SSD1306/ ~/Desktop/arduino-1.8.5/libraries/Adafruit_SSD1306/ ~/Desktop/arduino-1.8.5a/libraries/Adafruit_SSD1306/