4 ms·
ls assigned colors because it was configured to do so, either by you or your distribution. > plus, it's unusable in a script, because then "ls" suppresses the
by cerved 3y ago
ls assigned colors because it was configured to do so, either by you or your distribution.
> plus, it's unusable in a script, because then "ls" suppresses the color.
ls doesn't do anything different in a script, you probably just have an ls alias. Aliased are typically not sourced for non interactive shells
- hakre 3y agoit depends on the invocation, and by default it checks for tty or not. the aliasing often does not touch this. example alias: $ alias ls ls='ls --color=tty' and from ls(1): "With --color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COLORS environment variable can change the settings. Use the dircolors command to set it." ("tty" and "if-tty" are the same as "auto")