# How to set $ into a variable?

**URL:** <https://www.ruby-forum.com/t/how-to-set-into-a-variable/213986>\
**Category:** NGINX\
**Created:** [November 18, 2011, 4:07am UTC](https://www.ruby-forum.com/t/how-to-set-into-a-variable/213986 "2011-11-18T04:07:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [November 18, 2011, 4:07am UTC](https://www.ruby-forum.com/t/how-to-set-into-a-variable/213986/1 "2011-11-18T04:07:06Z")

</div>

nginx.conf:  
location / {  
…  
set $var “$uri=200k”  
…

and run “curl localhost/”

The module use ngx\_http\_get\_indexed\_variable() for $var will get the  
string “/=200k”, but I want the value is “$uri=200k”.

So any escape character supported in nginx.conf?

THANKS.

Posted at Nginx Forum:

> **[How to set $ into a variable?](https://forum.nginx.org/read.php?2,218536,218536#msg-218536)**
>
> nginx.conf: location / { .... set $var "$uri=200k" .... and run "curl localhost/" The module use ngx\_http\_get\_indexed\_variable() for $var will get the string "/=200k", but I want the value is "

---

<div class="post-metadata">

**Author:** ![bigplum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7c8e57/32.png) [@bigplum](https://www.ruby-forum.com/u/bigplum)\
**Post date:** [November 18, 2011, 2:59pm UTC](https://www.ruby-forum.com/t/how-to-set-into-a-variable/213986/2 "2011-11-18T14:59:23Z")

</div>

may be try set $var “$uri=200k”

2011/11/18 bigplum [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 

–  
MagicBear

---

<div class="post-metadata">

**Author:** ![bigplum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7c8e57/32.png) [@bigplum](https://www.ruby-forum.com/u/bigplum)\
**Post date:** [November 18, 2011, 3:16pm UTC](https://www.ruby-forum.com/t/how-to-set-into-a-variable/213986/3 "2011-11-18T15:16:44Z")

</div>

Hello!

On Thu, Nov 17, 2011 at 10:06:40PM -0500, bigplum wrote:

> So any escape character supported in nginx.conf?

Right now there are no way to escape $ in arguments which support  
variables. This is a bug.

Possible workaround is to use some variable defined with module  
which doesn’t support variables, e.g. you may do so with geo:

```
geo $dollar {
    default "$";
}

...
set $var "${dollar}uri=200k"
...

```

Maxim D.
