How to solve Environment Variables with $ Character?

Viewed 15

I have a Environment Variables:

 "PWD=uNfob$bA5052433"

When I print PWD out it always:

'uNfob'

I have tried :

'PWD=uNfob$bA5052433'

or

PWD='uNfob$bA5052433'

all not work,any suggestion ?

2 Answers

This works for me:

VAR='aaa$bbb'
echo $VAR

aaa$bbb

PWD is a special shell variable that represents the current directory. You might want to use someting else.

I solved it by 2 steps:

1.use single quotes 'PWD=uNfob$bA5052433'
2.add '/' 'PWD=uNfob/$bA5052433'
Related