I have this code in php:

header("Content-Type: text/plain");
exec("/bin/bash -c 'dircolors -b'", $result);
echo implode("\n", $result);

but it return

export LS_COLORS

Why I'm not getting color ANSI codes?


It works when I put export TERM="xterm" before dircolors.

  • 2
    Yes, see the output of dircolors -p for the list of terminals for which dircolors would set the colors and how. Feb 19 '14 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.