7

Running Linux Mint 17.3 Cinnamon

A while ago a created a script that changed the colors in the Terminal (to match a tutorial I was following)

However if I open the terminal on another account, I get this error:

dircolors: no SHELL environment variable, and no shell type option given

I no longer need the script anymore, so how can I track down where this thing is and get rid of it?

  • 1
    If its starting with the term, possibly .bashrc (if using bash) or in profiles. – cesar Jan 16 '16 at 4:15
  • How can I find it? I'm a Linux noob.... – 43Tesseracts Feb 14 '16 at 22:07
  • .bashrc should be located in your home directory. Profiles would be /etc/profiles. Just go into either file and try to find the dircolors var. – cesar Feb 15 '16 at 16:16
  • I have no .bashrc file in home, and /etc/profile does not contain dircolors in it. Any other locations? – 43Tesseracts Jul 5 '16 at 2:48
2

There are several places where you could have used a script besides ~/.bashrc or /etc/profile; without providing details on what changes you made, you will get only general advice. For instance, you might have

  • modified or added a file in /etc/profile.d
  • modified your ~/.profile or ~/.bash_profile
  • run the terminal via a script (or desktop "launcher")

You can find possible places using grep, e.g.,

$ grep -r -l dircolors /etc ~ 2>/dev/null
/etc/profile.d/colorls.csh
/etc/profile.d/colorls.sh
/etc/DIR_COLORS
/etc/DIR_COLORS.lightbgcolor
/etc/DIR_COLORS.256color

The error message is from dircolors (see source code), which does this when your SHELL environment variable is either unset or empty (see source-code for check).

  • Under debian based distros the file can be in /etc/skel/.bashrc – jeremiah Sep 16 at 17:26
0

If you don't need dircolors (colorful output from "ls") when SHELL is not set, then wrap your eval dircolors command in an "if".

If you always use /bin/bash, then maybe do like this:

# enable color support of ls and also add handy aliases
if [ $SHELL = "/bin/bash" -a -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'
    #alias grep='grep --color=auto'
    #alias fgrep='fgrep --color=auto'
    #alias egrep='egrep --color=auto'
fi

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.