Artificial intelligent assistant

Coreutils (or otherwise) `ls`: don't append symbol indicating type when piped Is there a way to get GNU coreutils `ls` (or any other open-source `ls`) to omit the trailing symbol (`*` for executable, `/` for directory, etc.) only when output is piped? the GNU `ls` has a `--color[=WHEN]` option accepting `auto` to automatically show colors when output is not piped, and omit the control sequences for colors when output is piped. I am looking for identical behavior regarding trailing symbols indicating filetype.

Presumably you have an alias for `ls` that's unconditionally adding the `-F` (or `--classify`) option. I would work around that by creating a wrapper function that tests whether the stdout is a terminal or not; only add the `-F` option if the output is a terminal.


function ls {
if [ -t 1 ]
then
command ls -F "$@"
else
command ls "$@"
fi
}


Adjust the other default options as you like.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 72279e1bb84fbcecde36a4bd7bc65d89