I tried to do a little searching myself on this issue, but was unable to find anything helpful. As far as I can tell, whenever I run a command in the terminal that errors, the next command I run will be skipped. A few examples with output:
$ rb
-bash: rb: command not found
$ ls <-------- this command gets skipped
$ cd nonexistent-dir
-bash: cd: nonexistent-dir: No such file or directory
$ cd existing-dir <------ this gets skipped
After the skip, everything resumes as normal until another error. I apologize for the likely awful formatting, this is my first time posting. I feel like I am missing something fairly obvious, but I would appreciate any help or guidance anyone has!
As an additional update, does anyone understand this behavior?
$ kj
-bash: kj: command not found
$ k;l
-bash: l: command not found
What I can note is that the terminal is skipping the input 'k;' between the errors. Unfortunately, I do not know how to further diagnose and solve the issue.
Related
I am installing software, and the last line (here is the picture of my terminal 1) delivers the message: -bash: syntax error near unexpected token `(' . I was thinking that I need to insert a backward slash somewhere in between the parentheses in the command line that gave me the error message when I ran it. However, I am skeptical of having to change anything because this line is from NASA from a tutorial to install certain software (seems pretty official). Thank you!
It looks like you're following the instructions at this website:
https://heasarc.gsfc.nasa.gov/lheasoft/install.html
And you've copied this command into your terminal
gunzip -c heasoft6.26(src|arch).tar.gz | tar xf -
The command isn't meant to be copied literally, the writers intend you replace the "(src|arch)" part to match the file you've downloaded.
Check what files exist in your directory by running ls -l
When you see the file you're looking for, run the command again with the correct filename.
For example if you downloaded the pre-compiled binary for OS X, run:
gunzip -c heasoft-6.26.1mac_intel_darwin18_patch.tar.gz | tar xf -
I am on Windows 10v1803, and i have WSL with Ubuntu installed and working well.
Recently, i was in vim, and appending some aliases to my .bashrc. After I finished editing, I wanted to exit without saving, did the usual Control-C, and instead of :q! I did !:q (Yes, silly typos). I realized my mistake, did the correct :q! and exited.
I came back ~1hr later, to make those 2 changes (below) and noticed that on startup, I got the error
-bash: /bin/bash:: No such file or directory
along with the normal startup
suda#suda:~$
Everything proceeds normally, but i'm concerned as to what that error means.
And, there is nothing that I could find on this apart from reinstall bash, which i have done 5 times, and makes no difference.
I proceeded to add the 2 aliases to my .bashrc, and everything works fine...
Some help as to what is happening here please?
And if you're wondering, these were what i was adding onto my .bashrc:
alias cls="clear"
alias md="mkdir"
Also, I feel that this won't go under askubuntu. If i'm wrong, please do tell me.
Edit: Here's an image
The error message is:
-bash: <file>: No such file or directory
Check that your script doesn't start with
#!/bin/bash:
and that you do not invoke /bin/bash: elsewhere, either.
(because, indeed, bash: should not exist in /bin)
I'm running Mac OSX 10.12.5. No matter what commands I type into the Terminal, all return -bash: -c: command not found or -bash: -a: command not found or whatever command I'm trying to run. I am extremely new to command-line coding, and I don't even know where to start looking, so forgive me if this question is a duplicate--I literally have no idea how to even begin to troubleshoot this. I've perused some other answers here, but they're all very specific to the circumstance. Can someone point me in the right direction on this?
Whenever I start up Terminal on my Macbook Air, I get this message:
-bash: ≈: command not found
How do I fix this error? I'm running Mavericks version 10.9.4 if that helps at all.
EDIT: Fixed this error by using the bash -x method, found out it was a random '≈' character left in ~/.profile that needed to be deleted. Thanks for the answers :)
To debug you can try this:
bash -x -l
(the -l might not be needed).
I definitely agree with Barmar, there is something in your bash startup scripts.
There is not a great way to do this, but here is the protocol to remedy it.
Confirm it is your bash profile by first killing the process with a control + C if it is hung. Then do a source ~/.bash_profile and see if you get that same error.
Backup your bash profile cp ~/.bash_profile bashprofile.txt
Then comment out part of your bash profile. With text wrangler you can do a command + slash.
Save, then do a source ~/.bash_profile and see if the error still prints.
Repeat with different areas of the script until you have isolated the infected region.
I've used virtualenv to program using my mac terminal for about 1/2 a year w/no issues. Suddenly today I began to get relative path errors when I tried to load python. There was no apparent reason for it, and eventually I tried restarting my computer.
Then I opened a new terminal window, and these new errors were present for the first time:
-bash: eval: line 4: unexpected EOF while looking for matching `"'
-bash: eval: line 5: syntax error: unexpected end of file
I assume the two misbehaviors are related in some way. Any idea what would be causing it? What files could the terminal be looking at that would cause this? AFIAK, I haven't changed anything on which it would depend.
Thx for any advice!
My guess is that a bash startup file (~/.bashrc, or possibly /etc/profile, ~/.bash_profile, ~/.bash_login or ~/.profile) contains a syntax error, and that causes all sorts of errors for other programs because the setup of the environment they expect does not take place.
From the error message it seems like an unterminated string constant, i.e. a missing ".
The bash manual on startup files has information about this.
You can also try to start bash in debug mode (bash -x (interactive shell) or bash -lx ( login shell)) to try to identify the error.