How to concatenate two strings to build a complete path

bash, linux

Solution

The POSIX standard mandates that multiple `/` are treated as a single `/` in a file name. Thus `//dir///subdir////file` is the same as `/dir/subdir/file`.

As such concatenating a two strings to build a complete path is a simple as:

full_path="$part1/$part2"

Problem

I am trying to write a bash script. In this script I want user to enter a path of a directory. Then I want to append some strings at the end of this string and build a path to some subdirectories. For example assume user enters an string like this: ``` /home/user1/MyFolder ``` Now I want to create 2 subdirectories in this directory and copy some files there. ``` /home/user1/MyFolder/subFold1 /home/user1/MyFolder/subFold2 ``` How can I do this?

Original source