Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-19-2004, 04:28 PM   #1
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Bash and ls problems

Hmm, this is quite strange. Today, I've noticed some odd problems with bash and ls that weren't there yesterday. As a normal user, whenever I open a console (xterm or rxvt), the first thing bash says is:

bash: [: =: unary operator expected

Followed by a login prompt. The same error pops up in a lot of other cases, such as when I use 'su -' to become root. Also, oddly, after becoming root, none of root's paths and whatnot (/sbin, /usr/sbin and the like) are in $PATH. Bash apparently ignored the hyphen after 'su'.

Anyhow, as if these aren't confusing enough, I've also found that 'ls -l' does not work; in fact, it causes a segfault:

eric@malcolm $ ls -l
total 987
Segmentation fault
eric@malcolm $

Same for any other user. /var/log/messages has no clues. Presumably it's just bash that's broken. The only explanation I'd have for why it's different today than yesterday is that I have 'emerge sync' and 'emerge -u world' run on a daily cron job (this is Gentoo, btw).

Anyone else experience this before?

edit: The bash unary operator warning occurs when my ~/.bashrc sources my ~/.profile, which in turn sources the global /etc/profile. Removing the line fixes the bash warning; sourcing /etc/profile still causes the warning, so I'll have to pin down where it is. At any rate, the ls -l segfault appears to be unrelated, since it still occurs even without sourcing /etc/profile.

edit #2: The /etc/profile script gives a bash warning because it uses the output of `/usr/bin/whoami`, which, apparently as of today, is "Segmentation fault". So whatever happened affected both ls and whoami... Time for some detective work...

Last edited by wapcaplet; 01-19-2004 at 04:32 PM.
Old 01-19-2004, 04:38 PM   #2
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Original Poster
Rep: Reputation: 48
Okay, whoami and ls are part of the coreutils package. I'm attempting to reinstall coreutils (hopefully all the segfaults that occur as a result of its use of chmod and such will not kill it).

I'm fairly certain I know exactly what happened now: I added 'static' to my USE variables in /etc/make.conf a while back. Apparently, it's a really bad idea to use that flag with some system apps. Oh well, live and learn
Old 01-19-2004, 04:44 PM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Did you do something with your /etc/bashrc file? Since the problem occurs when you are a normal user, and when you su to root, the ~/.bashrc file is probably ok. Also check the /etc/profile script. This script runs files with the .sh extension in the directory /etc/profile.d when you login.

Also check the environment variable $BASH_ENV. If it is set it will override which script is run when you logon.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Will installing BASH cause problems? vous Linux - Software 1 03-25-2005 08:55 AM
bash problems tobymiller Programming 2 01-28-2003 10:18 PM
Bash shell problems Regulator Programming 2 03-29-2002 05:53 PM
BASH problems subnet_rx Linux - General 3 11-17-2001 04:25 AM
Problems with bash script cowardnewbie Programming 0 09-30-2001 01:59 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration