Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dollar sign not allowed in env-cmd

I would like to ask if what's wrong with the dollar sign within the environment variable? I tried to do everything to fix the problem I've encountered using env-cmd package from npm with react

Sample

.env.development

REACT_SECRET_CODE=$B&FG%@(*4Fgawq@)

After a few hours of debugging then until I've noticed that it removes the $ sign from the example env variable REACT_SECRET_CODE then the variable shown in the console log is &FG%@(*4Fgawq@) instead of $B&FG%@(*4Fgawq@)

like image 710
Antolin Bernas Avatar asked Oct 30 '25 09:10

Antolin Bernas


1 Answers

Simply escaping the dollar sign will solve the issue.

The reason this has to be done is because otherwise, for $B, env-cmd will try to perform variable substitution on the variable B, which is empty and will resolve to an empty string.

like image 127
Filip Kaštovský Avatar answered Nov 01 '25 00:11

Filip Kaštovský