How can I stop the
eval statement from evaluating when it's being appended to a file as part of a
cat << __EOF__ command?
I manage services on a large number of Linux servers. Frequently, I end up with a headache, due to some of the default terminal colors specified by
LS_COLORS, so I wrote a quick script that I could just paste into the terminal to fix the color issues. This script is:
cat >> ~/.dircolors << __EOF__ OTHER_WRITABLE 01;30;41 # dir that is other-writable (o+w) and not sticky __EOF__ cat >> ~/.bashrc << __EOF__ # Customize directory listing colors. eval `dircolors ~/.dircolors` export LS_COLORS __EOF__ eval `dircolors ~/.dircolors`
This works fine for the session where I specify it, but when I log back in, I get the following error:
-bash: 30: command not found -bash: 41:: command not found [me@myserver ~]$
As I'm sure some of you have realized, when I look at my
.bashrc, the last 4 lines look like this:
# Customize directory listing colors. eval LS_COLORS='ow=01;30;41:'; export LS_COLORS export LS_COLORS
However, if I change it back to:
eval `dircolors ~/.dircolors`
everything works fine on the next login.