ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
5.55k stars 626 forks source link

Error message when opening bash from xfce4-terminal #437

Closed developer1105 closed 7 months ago

developer1105 commented 1 year ago

This message appears everytime bash is launched from xfce4-terminal:

cat: invalid option -- 'a' Try 'cat --help' for more information.

akinomyoga commented 1 year ago

As far as I search in the repository, oh-my-bash (OMB) does not contain cat -a.

What is the Bash version?

$ echo "$BASH_VERSION"

Can you get the log by the following steps?

  1. Add the following lines at the top of ~/.bashrc
exec 9>~/omb-debug.txt
PS4='+($BASH_SUBSHELL)${BASH_SOURCE[0]-(global)}:$LINENO${FUNCNAME:+($FUNCNAME)}[$?] '
BASH_XTRACEFD=9
set -x
  1. Open a new instance of xfce4-terminal
  2. Close the opened terminal by running exit
  3. The file ~/omb-debug.txt is created, so attach the file in a reply to this Issue.
  4. The lines added in step 1 can be removed.
developer1105 commented 1 year ago

Well, the bash version (as informed by the environment variable) is: 5.1.4(1)-release

I am currently using Peppermint Linux distro based on Devuan.

The debug is quite long: omb-debug.txt

I disabled git completion and the error disappeared (there was a line cat -aP git in the debug)

akinomyoga commented 1 year ago

Thank you for the debug log. According to the provided log, the affected line is the following:

https://github.com/ohmybash/oh-my-bash/blob/255bacacb503c2a6a507a58257ca7cd3219bb11d/completions/git.completion.bash#L6

So, type -aP git is transformed into cat -aP git in your environment. I suspect an alias is defined for type. Then, I find the following line in the log file:

++++(0)/home/allein/.bash_aliases:7(source)[0] alias type=cat

This means that an alias that replaces type with cat is defined in ~/.bash_aliases:7. The type command is actually an important Bash builtin command, so I strongly recommend not changing the meaning of type in Bash or in POSIX shells. There are still many other places where the type builtin is used in the codebase. Even if they do not output errors to the terminal, it would cause unexpected behaviors.

developer1105 commented 7 months ago

Ok. I have disabled the 'type' alias in my config. This issue can be marked as closed.