Score:1

Error message appears every time I start terminal, but not caused by .bashrc

tn flag

Whenever I start up a terminal, I am greeted with this message:

i#: command not found

However I can confirm that this is NOT caused by something in my .bashrc. I changed the name of my bashfile and created an empty one in it's place, and while all the other customization of my terminal is gone, this message remains.

I'm assuming there's some other files that are opened/read by terminal when it launches but I can't figure where this is. Presumably it's just a typo from trying to use insert in vim at some point.

Update: Running bash -x returns this. There's 800+ lines total but all occurrences of i# are in the first 14 shown here. I did not see anything in either .bash_history or .sudo_as_admin_successful

bgc@Russell:~$ bash -x
 + '[' -z '\s-\v\$ ' ']'
 + shopt -s checkwinsize
 + '[' -z '' ']'
 + '[' -r /etc/debian_chroot ']'
 + '[' -n '' -a -n '' ']'
 + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 + '[' '!' -e /home/bgc/.sudo_as_admin_successful ']'
 + '[' -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ']'
 + i# BASH HISTORY changes
 + '[' -x /usr/lib/command-not-found ']'
 + /usr/lib/command-not-found -- i#
i#: command not found
 + return 127
waltinator avatar
it flag
Read `man bash` about "Startup files". Can debug with `bash`'s `-x` option, e.g. `bash -x ~/.bashrc`.
tn flag
Thanks. It's does not appear to be any of the normal startup files (`etc/profile`, `.bashrc`, `.bash_login`, or `.profile`). I'm not sure of the utility of `bash -x ~/.bashrc` here (also ran it without specificing the file). It spat out a whole bunch of stuff but nothing that seems to be the source of this message
tn flag
Correction. Running `bash -x` without any file input did show something, although im not sure what to make of it! There's no `i#` in my `.bash_history` file, and `sudo_as_admin_successful` is an empty file
Score:2
in flag

This line tells you what is wrong:

+ i# BASH HISTORY changes

There is an i in front of a what supposed to be a comment.

To find the file, run

grep -rFl 'i# BASH HISTORY changes' ~/

If it cannot be found in your $HOME, try to search the full drive:

grep -rFl 'i# BASH HISTORY changes' /

You may need to run as root to access all your files. This may take a while or freeze up. Some of the directories that might cause issues can be excluded as such:

sudo grep -rFl 'i# BASH HISTORY changes' / --exclude-dir proc/ --exclude-dir sys/ --exclude-dir run/

Then, remove the i:

sed -i 's/^i# /# /' filename
tn flag
Thanks, gave that a try. Interestingly the only occurrence of `'i# BASH HISTORY changes'` I could find was from he bash history showing me running this exact command (I keep a second bash history going back months, but this is not loaded into terminal, and the phrase only appeared here after running it in a command). I tried looking for shorter variations like `# BASH HISTORY changes` or even just `# BASH` but no relevant files found.
pLumo avatar
in flag
The `grep` command searches your Home dir ( `~`) only. Maybe try to search the full drive: `grep -rFl 'i# BASH HISTORY changes' /`.
tn flag
GOT IT! Took forever, and the command kept freezing up, but eventually omitting some problematic directories with `sudo grep -rFl 'i# BASH HISTORY changes' / --exclude-dir proc/ --exclude-dir sys/ --exclude-dir run/ ` revealed the file as `/etc/bash.bashrc` - where I had added a comment and some lines to customize bash history usage.
pLumo avatar
in flag
Great :-) Sure it takes long as it will need to open each and every file on your drive ...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.