I would like to expand one variable in bash and would like to get result within single quotes itself.
for example , my script below includes:
sqlplus -s user/password
select sys_context
Where schemaname = '$USERNAME'
I would like to expand it as:
Where schemaname = 'XYZ_OWNER'
I tried something like :
where schemaname = "'""$USERNAME""'"
But it is throwing me below error:
where schemaname = "'"XYZ_OWNER""'"
Please suggest how can this be resolved.
>Solution :
To get parameter expansion without wordsplitting, double quotes are used. Example:
USERNAME=fluffy
where_clause="where schemaname = '$USERNAME'"
This sets the variable where_clause to the value where schemaname = 'fluffy'.