Hi today for unknown reason, if I typed the following command "vim \tab" in bash terminal to hopefully get an auto-completion, I get the following error:
$ vim bash: command substitution: line 22: syntax error near unexpected token `}'
bash: command substitution: line 22: ` }'
This error does not happen if I typed '\tab` at the end of other commands such as 'ls', or even an alias of vim such as 'alias v=vim'.
This error does not happen in another gnome-terminal, either.
Not sure what is causing this (a vim plugin?). Any idea? thanks.
Found the root cause. I created an alias done, and the "done" conflicts with the bash keyword "done". Problem solved by renamed the alias.
Related
My "man" utility on MacOS Ventura 13.1 seems to be broken. When I try running "man ls" from the command line I get:
/usr/bin/man: eval: line 413: unexpected EOF while looking for matching `''
/usr/bin/man: eval: line 414: syntax error: unexpected end of file
I expected to see the man page for "ls" displayed in the terminal. Any ideas how to fix this (short of editing /usr/bin/man itself)?
Oops...please ignore. I found the issue. I had an old setup for MANPAGER that integrates with the "bat" utility for displaying man pages that was the culprit.
Each time I open my terminal(mac laptop). I get this weird looking error which never goes away. Almost a year now. Please what does it mean?
-bash: command substitution: line 1: syntax error near unexpected token `newline'
-bash: command substitution: line 1: `/usr/libexec/java_home -v <version>'
https://i.stack.imgur.com/4sXcY.png
Although the terminal still works but I don't know what these two lines mean.
Every time I launch terminal, I keep getting this syntax error.
-bash: /Users/Jake/.bash_profile: line 2: syntax error near unexpected token `then'
-bash: /Users/Jake/.bash_profile: line 2: `alias mysql='/Applications/XAMPP/xamppfiles/bin/mysql'if which rbenv >
/dev/null; then eval "$(rbenv init -)"; fi'
How do I fix this?
if you don't want that alias just edit your /Users/Jake/.bash_profile and remove or comment that line with a # at the begininning . If you do want that alias please post your .bash_profile so we can look at what the error is.
Hope it helps
I have just installed CygWin and curl because I wanted to do something unrelated. But now, I want to execute a .lua file in CygWin and I want the results to print on the current window, the CygWin window. I want it to be like the equivalent of just opening CMD and then do cd <directory where the file is>. And then just do <filename>.lua and it prints the results. So how would I go about doing that? Sorry, I'm kinda new to Linux, Unix, CLI, ect., and I don't know much about the bash command.
I tried using the method from here: How do I execute a file in Cygwin?
I just did ./<filename>.lua and I get
./<filename>.lua: line 1: syntax error near unexpected token `"Hello world"'
./<filename>.lua: line 1: `print("Hello world")'
The file just has
print("hello world")
If your file is marked as an executable, running ./<filename>.lua will default to executing the file as a shell script, (i.e., sh, bash, zsh, etc.). This results in the error you see, which is easily recreated.
In bash:
$ echo 'print("Hello world")' > script.sh && chmod +x script.sh && ./script.sh
./script.sh: line 1: syntax error near unexpected token `"Hello world"'
./script.sh: line 1: `print("Hello world")'
The first thing you need to do is make sure Lua is installed (rerun the Cygwin setup GUI, or use a tool like apt-cyg), and is located in your $PATH.
Then instead of executing the file directly, run it with the Lua interpreter.
$ lua <filename>.lua
Alternatively, use a shebang directive to instruct the shell on how the file should be executed.
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.