"grep: +0: No such file or directory" returned after every command

I’m working with a SUSE 12 Linux system and when logged in as ‘root’ I get “grep: +0: No such file or directory” returned after every command or even pressing [Enter] several times. How do I debug/troubleshoot what’s causing this?

infosphere04v:~ #
grep: +0: No such file or directory
infosphere04v:~ #
grep: +0: No such file or directory
infosphere04v:~ #
grep: +0: No such file or directory
infosphere04v:~ # uptime
 12:39pm  up   3:44,  3 users,  load average: 0.14, 0.05, 0.04
grep: +0: No such file or directory
infosphere04v:~ #

A wild guess: there is something broken in “/root/.bashrc” or similar shell startup file.

My suggestion:


cd /root
mkdir old
mv .bash* old/.
mv .profile old/.

If root access is too broken to allow that, then boot from rescue media, mount your root file system and make those moves to the mounted file system.

When you have done those moves, reboot and see if everything works. And if it does work, you might want to examine those broken files to see what happened.

BTW, it seems that you are using SUSE Linux Enterprise Server Desktop version 12. Here however you are at the openSUSE forums, not at the SLES/SLED forums. They area at http://forums.suse.com/
You are welcome here, but please take care that people here do not use SLES/SLED and certainly not version 12.

Thank You! That was it
Through .bashrc comment line trial & error, found this line causing that output. I’ll leave it commented out!

#alias dirs="ls -al | grep '^d'" # list directories under the current working directory

Hm,

I do not have that alias (but hey, this is openSUSE, not SUSE).

The command itself is no problem:

henk@boven:~> ls -al | grep '^d'
drwxr-xr-x 37 henk wij    4096 Sep 15 19:11 .
drwxr-xr-x 11 root root   4096 May 22 20:26 ..
drwx------  2 henk wij    4096 Dec 20  2016 .QtWebEngineProcess
....
....

But indeed

henk@boven:~> alias dirs="ls -al | grep '^d'"
grep: +0: No such file or directory
henk@boven:~>

The alias created is

alias dirs='ls -al | grep '\''^d'\'''

Which contains a bewildering number of single quotes.

:question:

If you want such an alias, try:

alias dirs="ls -al | grep ^d"

Sometimes less is more.