Empty enviroment variable name

385 views Asked by At

I'm debugging an application in Ubuntu 20.04 with:

ltrace -e getenv ./cmd

I want to know which enviroment variables and their respective values are involved. I got surprised when I realized that there is an "empty name variable" without a value. There is the ltrace output:

....
    linux_a64.installos->getenv("")            = nil
    linux_a64.installos->getenv("TMPDIR")      = "/tmp"
    linux_a64.installos->getenv("DEBUGCMD")    = nil
....

Does anyone knows what this could be? There is a way to give an empty value to a enviroment variable?

1

There are 1 answers

1
Lucas Mior On

Probably this environment variable wasn't set yet.

$ env | grep POTATO

$ echo $POTATO

You can get the environment variable value, even if that wasn't set before..