Why when I open terminal do I see the following: - bash

Last login: Mon Jun 17 10:41:49 on ttys000
-bash: export: `2019.03': not a valid identifier
XXX:~ YYY$
(Note the XXXs and YYYs are just replacement)
Specifically, I am talking about the
-bash: export: `2019.03': not a valid identifier
I just installed Anaconda on Mac and then tried to update it and did in it incorrectly and now when I open the terminal, this appears every time. I know that 2019.03 is the current version of Anaconda and I have since fixed Anaconda so that my version is currently that version but I do not know what this "not a valid identifier" this is. Any help with how to address what it is, why it is there, and how I can remove it would be much appreciated.
EDIT: Thanks for assistance. I opened the bash profile and some of the comments was in the same line as the export path line and that was messing it up. Thank you!

If you open the terminal and see that there is some error coming from ~bash, it likely has something to do with the bash profile. You should open that up and check to make sure that nothing is out of place like having more than one thing on the same line since it can be sensitive to that.

You see the following due to the anaconda3 2019.03 installer trying to export a non valid identifier from your .bash_profile file. Note, this file is usually hidden due to the period in front of the file name.
The following is what was appearing in my terminal:
-bash: export: `2019.03': not a valid identifier
Do the following to fix this issue.
$ nano .bash_profile
Now you should be inside of the .bash_profile file using the nano editor.
# comment out or remove the following line from .bash_profile
# then save before you exit the file
#export PATH="MAMP_PHP:$PATH"# added by Anaconda3 2019.03 installer
Close your terminal and open it again, and the annoying "-bash: export: `2019.03': not a valid identifier" should be gone whenever you open a new terminal.

Related

Terminal modified permanently by vscode

I installed vscode today and followed the steps on tutorials on youtube to set up. My terminal started to act weird after I called python through the terminal and tried to use pip install command but failed. I uninstalled the app, deleted all the relevant files, and tried to reopen the terminal. The terminal still has the same warnings.
I have contacted Apple Tech support and they say my terminal got modified by the app. They asked me to contact the app developer.
I don't know what I did to get where I am now. I would appreciate any help that can bring my terminal back to normal.
Below are the warnings even after I uninstalled the app:
Last login: Wed Jun 10 23:02:45 on ttys000
You have mail.
-bash: Saving: command not found
-bash: ...copying: command not found
-bash: ...saving: command not found
-bash: ...completed.: command not found
-bash: Deleting: command not found
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
ZhouChristinas-MacBook-Pro:~ zhouchristina$
Check your shell's startup script, it looks like you have text there that aren't shell commands. I don't know whether you have bash or zsh as your shell, but check all of these files just to be sure:
~/.bashrc
~/.bash_aliases
~/.bash_profile
~/.bash_login
~/.zshrc
~/.zshenv
~/.zprofile
~/.zlogin
~/.profile
Also look into any files that are sourced by these files.

How to fix the invalid identifier of bash?

When I open terminal, I get following error at the top.
bash: export: `/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/root/bin': not a valid identifier
I am new to linux and I was trying to execute ls command but it was not working and giving some error so I followed this answer to fix it. Now I am able to list down the file using ls command but getting this error. I wonder it will have some serious affect somewhere else or not.
Turns out my path in ~/.bashrc was not correct. So this is what I did.
gedit ~/.bashrc
After the in the opened file I update the PATH to this at the end of the file.
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

bash_profile Powerline setup

I am learning the command line and trying to customize my environment to have Powerline functionality.
I have installed the Powerline file from GitHub and am trying to add to my path variable.
My .bash_profile is set as follows:
export PATH=$PATH:$HOME/Library/Python/2.7/bin
export PATH=$PATH:$HOME/Library/Python/2.7/binpowerline-daemon -qPOWERLINE_BASH_CONTINUATION=1POWERLINE_BASH_SELECT=1. /Users/johnmyers/Library/Python/2.7/lib/python/site-packages/powerline/bindings/bash/powerline.sh
I receive the following error messages when launching terminal.
-bash: export: `-qPOWERLINE_BASH_CONTINUATION=1POWERLINE_BASH_SELECT=1': not a valid
identifier
-bash: export: `/Users/johnmyers/Library/Python/2.7/lib/python/site-packages/powerline/bindings/bash/powerline.sh':
not a valid identifier
I would appreciate any guidance in the right direction on this issue. Thank you.
The stuff you added needs to be broken up on individual lines with newlines between them. I can only guess where the newlines are supposed to go, but something like
export PATH=$PATH:$HOME/Library/Python/2.7/bin
# No need to repeat this
# export PATH=$PATH:$HOME/Library/Python/2.7/bin
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /Users/johnmyers/Library/Python/2.7/lib/python/site-packages/powerline/bindings/bash/powerline.sh

Basic command lines on Mac terminal not working

I changed the bash profile while trying to install mongodb and none of my command lines are working on terminal. I read online that I need to fix the $PATH but I can't even access it when none of my commands are working.
Help?
Mistakenly I also ran into same problem where to resolve this I had to reset my PATH variable to basic settings as below :
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin"
Once you set PATH variable now you can open the .bash_profile file in same terminal session only and make changes accordingly. This will resolve your problem.
Ok I found the answer from here:
"Open Terminal, and go to File (or Shell) -> New Command. Type in open -e .profile (or substitute some other file instead of .profile), and hit Run. That should open TextEdit with the file you want to fix; you can remove the offending lines there."
in my case i typed in nano .bash_profile and that allowed me to edit my bash profile and fix the issue.
can't use terminal from error in .bash_profile
Run this in terminal:
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

How to get Terminal on OSX to start up clearly?

I am new to Mac OSX. Once after i typed export command in terminal, each time i start up the terminal, two messages show up:
-bash: export: '=': not a valid identifier
-bash: export: `:/Users/Li/File/Java/TStream': not a valid identifier
I know that clear and command+k can got a clean screen. But I just want to start up with a clean terminal.
Go to your terminal and type the
clear
command. This should clear your screen. Maybe what you're looking for is a way to have bash run that each time. If so, cd to your home directory:
cd ~
then edit the file called .bash_profile , or maybe .bashrc
On the last line write the word 'clear' without quotes, then save. This file runs when bash starts up, and the last thing it will do, therefore, is clear the screen.
For more info, checkout: this
EDIT:
Incidentally, I just realized you might want to clear the error. When you open up your .bashrc file, see if you can find a line that resembles the error you're getting, then comment it out.

Resources