You are not logged in.
Hello, I'm having an issue with my terminal (I use gnome). The thing is every time I open it, an error that says "bash: $'\357\273\277#': command not found" appears before the prompt, and it gets very annoying. I looked up on the internet and there are a few threads on some forums about that, but it never got resolved. Here's some info that may be helpful:
$ cat .bashrc
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
alias premove='pacman -Rns'
#PS1='[\u@\h \W] \e[0;31m\$:\e[m '
fortune -a$ cat .bash_profile
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startxThank you. If you need any more information, please ask.
Last edited by TMalthus (2013-10-14 17:48:05)
Offline
An article says that "\357\273\277" is a UTF-8 byte order mark. The article is not about bash, but they too had trouble when processing a file with that mark. It is not needed they say. Maybe your fortune program's fortunes or the program itself has such a mark? Or some other scripts called from /etc/profile or something of that sort...
My first hunch is: try commenting that fortune line to eliminate if that is where the problem is. Otherwise it is caused due to some rogue script which is called by your bashrc, or some file in /etc/ that is read by bash. I am sorry, but I don't exactly know which files they are. Try the Arch wiki for the correct sequence of files read by bash.
It might also have come in accidentally into your bashrc. Try creating an empty bashrc by
mv ~/.bashrc ~/.bashrc.old
touch ~/.bashrcAs an aside, how would one search for that 'byte order mark' using grep? I don't know if grep is UTF-8 capable, but I think there must must be some way to do it, even if grep doesn't work ... Tell me if you find out. It would make debugging your files easier.
Hope it helps. And do post back on your progress.
Offline
Searching and I found this http://www.unix.com/unix-desktop-dummie … error.html
Try to list all the bash relative files.
KISS my Arch
Offline
An update to make it easier for you:
awk '/\xef\xbb\xbf/{print FILENAME " @ " FNR }' filename(s)The above snippet should print files which have the byte order mark and the line at which it is present. You can probably refine it to show the exact position. Also you can input input multiple files and the script should work just fine.
A little note: The BOM indicates the 'byte ordering', that is its 'endianness'. It is only relevant for UTF-16 and UTF-32 as they are multibyte. UTF-8 stores each character as a single byte, and so the endianness doesn't matter. So you can safely remove it. And again the each kind of UTF has a specific code to indicate endianness. The one you are getting is for UTF-8, so no possible chances of error there.
And again it seems that it is only inserted in the beginning of a byte stream. So that probably means it would be the first sequence of bytes in your problematic file. If that is indeed the case then do the following to get a no BOM version:
awk '{if(NR==1)sub(/^\xef\xbb\xbf/,"");print}' file.name > file.nobom.nameIt appears it is inserted by some programs automatically when they edit or manipulate stuff. But it breaks some things apparently.
Also the UTF character code for BOM is 'U+FFEF'
Check out the BOM FAQ to learn more.
I am by no means a UTF or awk expert. I just found these things out after googling. Backup before modifying anything, and post back with your progress. Also tell me if there are any mistakes. I will correct them.
Good luck.
Last edited by richcocoa (2013-10-14 10:02:17)
Offline
Searching and I found this http://www.unix.com/unix-desktop-dummie … error.html
Try to list all the bash relative files.
$ pwd
/home/myuser
$ ls -a | grep bash
.bash_history
.bash_logout
.bash_profile
.bashrcI have already read that post, but there's no .bash_aliases.
Offline
It might also have come in accidentally into your bashrc. Try creating an empty bashrc by
mv ~/.bashrc ~/.bashrc.old touch ~/.bashrcHope it helps. And do post back on your progress.
awk '/\xef\xbb\xbf/{print FILENAME " @ " FNR }' filename(s)
The latter help me notice that the issue was in .bashrc. So I made a "less .bashrc" and I found out that there was a strange character there, I tried to delete it but I could not. So with the advice in the former I completely solved the issue.
Thank you very much!
Last edited by TMalthus (2013-10-14 17:49:04)
Offline
If you use vim you can do this with :set nobomb
Offline