By default radare setups a clean environment for the child process to avoid antidebugging tricks like checking for '_' or 'LD_' and to avoid interferencing the stack address space compared to a real process execution.
The environment setup can be redefined using the 'file.dbg_env' eval variable pointing to a file with contents like:
The format is similar to the shell 'export' command, but more flexible, because it supports loading variable contents from external files. Here's an example:
# This is a sample file for file.dbg_env PATH="/bin:/usr/bin" HISTFILE=@/bin/ls
The HISTFILE environment will be filled with the contents of the file '/bin/ls'.
Then run radare with these arguments:
$ radare -e file.dbg_env=env.txt -d ls