LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-26-2006, 03:27 PM   #1
EAD
Member
 
Registered: Mar 2006
Distribution: ARCH linux
Posts: 137

Rep: Reputation: 15
Question Strength problem with bash


Hii when going to root I get this thing from the BASH
-bash: [: [\u@\h: binary operator expected
and my .bashrc is
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

test -n "$DISPLAY" && export TERM=xterm-color

export XAUTHORITY=/home/guest/.Xauthority

/etc/./bash_completion

Can someone help me please solve this?
in my other user I do have PS1='[\u@\h \W]\$ ' and it works good.
I am using ARCH linux btw.
 
Old 03-26-2006, 03:34 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
ok, with my psychic hat on, i'm guessing you visually copied the original example into your own .bashrc? you probably have used backticks instead of quote marks, i.e. ` instead of '. doing backticks means that the contents will be executed, and tso that first [ is being executed, and as [ is an alias of the test command, you have a test error. changes them for regular single quote marks.
 
Old 03-27-2006, 04:01 AM   #3
EAD
Member
 
Registered: Mar 2006
Distribution: ARCH linux
Posts: 137

Original Poster
Rep: Reputation: 15
No, I am using ', and even tried changeing it to " , still not working
 
Old 03-27-2006, 07:00 AM   #4
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Please look closely for even very small syntax errors.

The PS1 line you've posted works just fine on my box, even for root.

Try putting some echo commands just below/above the PS1= line, just to make sure that the error
indeed comes from that line.
ie
Code:
echo "Setting PS1 now:"
PS1='[\u@\h \W]\$ '
echo "PS1 setting done"
in root's .bashrc.
 
Old 03-27-2006, 07:22 AM   #5
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 54
Quote:
/etc/./bash_completion
This line looks odd to me.
Could it be that is is supposed to do that ?:
. /etc/bash_completion
or
source /etc/bash_completion
 
Old 03-27-2006, 10:48 AM   #6
EAD
Member
 
Registered: Mar 2006
Distribution: ARCH linux
Posts: 137

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jomen
This line looks odd to me.
Could it be that is is supposed to do that ?:
. /etc/bash_completion
or
source /etc/bash_completion
amm yes I want to run the bash_completion, what's wrong with this?
 
Old 03-27-2006, 12:10 PM   #7
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 54
Where IS the file "bash_completion" really?

What you have there is probably a typo:
Quote:
/etc/./bash_completion
this would be a directory under /etc , named "." (point) which holds the file "bash_completion"
While the "." should point back to the directory itself - it is redundant and useless at best
- give the correct path name...

Both of these are the same thing:

. /etc/bash_completion
or
source /etc/bash_completion

and assume the file "bash_completion" is in /etc
 
Old 03-28-2006, 01:03 AM   #8
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Quote:
Originally Posted by EAD
run the bash_completion
Do you really want to run the bash_completion program, which I assume is a Bash script?

If that is supposed to change some environment variables for all your bash shells, then you need
to "source" the script rather than executing it.
"sourcing" includes the code of bash_completion script in your .bashrc (as if the code is copy-pasted into the .bashrc). This will also run the code, but change the environment of your bash shells.
Just executing the bash_completion script (not sourcing it), will only make it change it's own environment instead of the environment of all subsequent programs and shells.
 
Old 03-29-2006, 01:38 AM   #9
EAD
Member
 
Registered: Mar 2006
Distribution: ARCH linux
Posts: 137

Original Poster
Rep: Reputation: 15
So how can I run the bash_completion program ?
 
Old 03-29-2006, 02:32 AM   #10
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
You can either run it by calling
/path/to/bash_completion
(in your case, the path to the bash_completion seems to be just "/etc/")

You can source it by calling:
. /path/to/bash_completion
 
Old 03-29-2006, 04:15 AM   #11
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 54
If you want to have the functions of bash_completion available you dont run this script - as has been pointed out more than once - the reasons too.
You can't run it because it is no shell-script - it just contains the functions...
You "source" it (make the funktions available inside bash) by including either one of the lines I gave here as an example into your personal .bash_profile or .basrc,
or system-wide by putting these lines into /etc/profile
It is just a typo in what you have now.
 
  


Reply


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
Getting AP signal strength via C program ... toships Linux - Wireless Networking 5 01-07-2009 02:35 AM
Wireless mouse battery strength Duranthas Linux - Hardware 1 09-07-2005 09:28 PM
encryption strength? zer0python Programming 2 08-16-2005 10:42 AM
Wireless signal strength meter? Kethinov Linux - Software 1 10-29-2004 11:49 PM
Help using Crack for testing password strength dai Linux - Security 2 07-02-2003 03:34 PM


All times are GMT -5. The time now is 09:54 PM.

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