How to expand variables within single quotes in bash

By default single quotes will preserve everything as is. So expansion of variable will not happen.

In-order to resolve this problem we need to close the quote before the variable and open the same after the variable.

Eg: 'before'"$variable"'after'

Here the variable will be expanded without any issues.

That's all…

Leave a Reply