LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-19-2002, 09:15 AM   #1
abyss
Member
 
Registered: May 2001
Location: New York, USA
Distribution: AIX, Ubuntu
Posts: 113

Rep: Reputation: 15
Question .bash_profile question


I've recently started using Slackware and like it so far. This is a very minor and trivial question, but....

Slackware did not have a .bash_profile preconfigured in my home directory. I normally use it to create my user-specific aliases. No problem, I just recreated one exactly as it appears in my Red Hat 7.2 box.

I've listed it below at the bottom of the post in the original form (without the aliases because they have no effect on the error).

When I log in, it works (& the aliases work fine) but it gives me the following error:

[: missing ']'

I'm not much of a coder and am just beginning to learn bash custom configuration. What is my syntax error? I get no such message in Red Hat.

BTW, bash is version 2.05.8(1) in Red Hat and 2.05.0(1) in Slack if that matters.

Thanks in advance

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
 
Old 03-19-2002, 09:23 AM   #2
Sixpax
Member
 
Registered: Mar 2002
Distribution: Mandrake 8.1
Posts: 386

Rep: Reputation: 30
There's absolutely nothing wrong with that code. Maybe the problem is in your .bashrc?
 
Old 03-19-2002, 09:35 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
it's possible you havent actually got a space between .bashrc and ] . that's the usual place where that error comes from , as many people don't realise that [ is actually a program, and needs ] as a parameter to work, and thus needs a space either side. the problem might not be in that file tho like sixpax said.
 
Old 03-19-2002, 09:41 AM   #4
abyss
Member
 
Registered: May 2001
Location: New York, USA
Distribution: AIX, Ubuntu
Posts: 113

Original Poster
Rep: Reputation: 15
kewp,

you were exactly right. I missed the space there between .bashrc ]

There are so many places in *nix where spaces don't matter I guess I've gotten careless

Thanks

Cheers,

abyss
 
Old 03-19-2002, 09:48 AM   #5
Sixpax
Member
 
Registered: Mar 2002
Distribution: Mandrake 8.1
Posts: 386

Rep: Reputation: 30
That's the first thing I looked at when I saw your error, but I swear it looks like you have a space there. Did you cut and paste that script or type it by hand in your post?
 
Old 03-19-2002, 09:52 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
wow, good guess! that's a first! i was a bit confused, cos that is exactly the standard .bash_profile script... i could't quite understand why you even copied the comments////
 
Old 03-19-2002, 10:29 AM   #7
abyss
Member
 
Registered: May 2001
Location: New York, USA
Distribution: AIX, Ubuntu
Posts: 113

Original Poster
Rep: Reputation: 15
Sixpax,

I cut and pasted from the Red Hat box (the one I based it on), but I typed it by hand into the Slack box, thereby missing the space.

The slack box is not on the network yet, so I can't get data in or out of there yet.

Thanks again
 
Old 03-19-2002, 11:04 AM   #8
Sixpax
Member
 
Registered: Mar 2002
Distribution: Mandrake 8.1
Posts: 386

Rep: Reputation: 30
Whew! I thought I was losing it

Nothing worse than finding the bug in code that isn't buggy
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.bash_profile question Gald3r Linux - Newbie 8 09-20-2005 07:17 PM
where is ~/.bash_profile? Jskill007 Slackware 4 09-17-2004 11:04 PM
.bash_profile sikandar Linux - Software 9 08-31-2003 10:01 AM
.bash_profile question jalburger Linux - Newbie 1 03-18-2003 04:42 PM
.bash_profile Wasim Haider Linux - General 2 09-16-2002 07:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:18 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