Someone sent me email (don't do that if you aren't a customer - post here) with this problem:
Seems like none of the standard commands are working on my terminal It logs me in ok with my welcome screen but up top it reads Last login: Wed Mar 2 10:56:54 on ttyp1 Welcome to Darwin! -bash: export: `/bin:/sbin:/usr/bin:/usr/sbin': not a valid identifier -bash: export: `/usr/local/mysql/bin:': not a valid identifier My-Computer:~ user$ What lead to this problem is when I was trying to install mysql on my powermac G4, I was going off of a book of instructions from mac OS X web development book, everything was going find up until the last few instructions then it error msg ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PRIVILEGES ON *.* TO mysql@localhost IDENTIFIED BY 'mypassword'' at line 1 mysql> It began to get messy before the error msg concerning bash when on step 9 where the command is Echo 'export PATH=/usr/local/mysql/bin: $PATH' >> ~/.bashrc I wasn't sure if I was even suppose to do this because I think I already have bash and tcshrc on my mac It followed by having me to a touch .bash_profile then ls -Ga l to see the list which it did but then Doing .~/.bashrc ENV=$HOME/.bashrc export ENV it got messy again and when it asked to save :w apparently that command meant to sort and it continued to get messy not sure what it actually did I managed to still find my way to step 10 and it seem to accept password but then that's when the error msg appeared Currently, anytime I try to enter a command it reads -bash: command not found even to list directory still not working Not sure where to go from here any ideas ? Thank you for your time basically no commands work in the terminal all i get is this Welcome to Darwin! -bash: export: `/bin:/sbin:/usr/bin:/usr/sbin': not a valid identifier -bash: export: `/usr/local/mysql/bin:': not a valid identifier I'm using mac os x 10.3.7
What's happened is that's he's messed up his .bash_profile and possibly .bashrc
I can't really tell why from the mail; possibly bad quoting (" or ` vs ' in following the directions), but it doesn't really matter. Do this
Or use Finder to rename these graphically..
then logout and log in again. Figure out what happened, fix it and put 'em back.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2009-11-07 Tony Lawrence
The three chief virtues of a programmer are: Laziness, Impatience and Hubris. (Larry Wall)
Fri Mar 11 02:21:29 2005: 164 anonymous
that code worked perfectly thanks my terminal is accepting comands now thanks again, now i feel guilty sorry for sending it through the email
Fri Mar 11 13:03:54 2005: 166 TonyLawrence
There's no reason to feel guilty - you offered to pay for an answer. I just knew this was simple, and more importantly could be useful to other people, so it should be a public post.
I'll answer questions here if I think the subject can be of value to other people, so why not try for a free answer first?
Sun Apr 10 17:06:57 2005: 320 anonymous
The problem was the space between the new path elements and $PATH. Shell assignments (FOO=bar:baz:quux) can't have spaces in them without being quoted (nor do you want your path to have a space in it), so bash did this:
FWIW, the command flags a variable for export to subshells. It doesn't snapshot the current value, and it doesn't require the value to be specified on that line (although that syntax is permitted in some shells).
For portability, clarity, and ease of debugging, I'd prefer to see that .bashrc snipped rewritten like this:
which has the added advantage that if the extra-space-before-$PATH typo had been made using this syntax, it would have raised an error on the assignment line and isolated it from the export command, which wasn't really the problem.
Sun Apr 10 17:10:43 2005: 321 anonymous
>Oh, lovely; all my HTML tags are visible in my post, because I entered them in capital letters just like the posting instructions say. How hideous.
Sun Apr 10 18:55:16 2005: 323 TonyLawrence
Sorry - forgot /i I'll fix..
------------------------
Printer Friendly Version
Mailbag: bashrc broken Copyright © March 2005 Tony Lawrence
Have you tried Searching this site?
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.
Contact us
Printer Friendly Version