Can anyone explain how to make this code work?
echo \'Welcome \'
Inside single quotes, variable names aren't parsed like they are inside double-quotes. If you want to use single-quoted strings here, you'll need to use the string concatenation operator, .:
echo 'Welcome ';
By the way: the answer to the question in the title is that in order to use a literal single-quote inside a single-quoted string, you escape the single-quote using a backslash:
echo 'Here is a single-quote: \'';