On Ubuntu 12.04, I have an environment variable defined in
/etc/environment like this:
When I ssh into the server to check the value, I get this:
$ env | grep FOO FOO=value_before
I’m guessing it is treating the
# as a comment and stripping it out, however, this works:
$ . /etc/environment $ export FOO $ env | grep FOO FOO=value_before#value_after
I’ve tried escaping the
# like this:
But that doesn’t work, instead I just get this:
Any ideas on how to make the hash be treated like part of the value? Any help would be great.
Values I’ve tried in the
FOO='value_before#value_after' FOO="value_before#value_after" FOO='"value_before#value_after"' FOO="value_before\#value_after" FOO='value_before\#value_after'
And other various combinations of the above. A lot of these will work when you just normally set them in the shell. But they don’t seem to work in the
$ FOO='foo#bar' $ echo $FOO foo#bar
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.