/.profile "Unexpected EOF while looking for matching `" ' - bash

I am new to the terminal and have been working towards adding Grunt to my workflow. I am receiving this error in my Terminal and I don't see any missing " in my .profile file.
-bash: /Users/shawnwilliams/.profile: line 4: unexpected EOF while looking for matching `"'
-bash: /Users/shawnwilliams/.profile: line 6: syntax error: unexpected end of file
Here is my .profile (Edited as I provided the wrong file.)
export PATH="$PATH:$HOME/.rvm/bin:/usr/local/bin” # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

It looks like you're using a non-ascii double-quote character after /usr/local/bin. Try changing the double quotes to ascii.

The issue is in your .profile, not .bash_profile, as indicated by the error message.
your .profile is sourced in the first line and then bash complains.

Related

zshrc outputing cryptic errors on iterm2 at loading

I am a Mac user on osx 10.15.7 (Catalina).
I recently updated brew and upgraded formulas with it.
Since then, my terminal has become erratic and prints out these errors:
_zulu_init_setup_completion:9: compinit: function definition file not found
/user/path/.zulu/packages/tipz/tipz.zsh:86: add-zsh-hook: function definition file not found
_zulu_init:48: promptinit: function definition file not found
_zulu_init:50: command not found: prompt
/user/path/.zprezto/init.zsh:14: is-at-least: function definition file not found
prezto: old shell detected, minimum required: 4.3.17
/user/path/.zshrc:19: promptinit: function definition file not found
/usr/local/Cellar/zplug/2.4.2/autoload/init.zsh:16: colors: function definition file not found
polling.zsh:17: add-zsh-hook: function definition file not found
# the following line is repeated at least 20 times
__zplug::core::core::get_interfaces:49: regexp-replace: function definition file not found
__zplug::core::core::prepare:67: compinit: function definition file not found
[zplug] ERROR: The loading of zplug was discontinued.
/user/path/.nvm/bash_completion:87: bashcompinit: function definition file not found
/user/path/.nvm/bash_completion:88: compinit: function definition file not found
/user/path/.nvm/bash_completion:95: command not found: complete
/user/path/.zshrc:35: command not found: gcloud
/user/path/google-cloud-sdk/completion.zsh.inc:1: bashcompinit: function definition file not found
/user/path/google-cloud-sdk/completion.zsh.inc:4: compinit: function definition file not found
/user/path/google-cloud-sdk/completion.zsh.inc:37: command not found: complete
/user/path/google-cloud-sdk/completion.zsh.inc:62: command not found: complete
/user/path/google-cloud-sdk/completion.zsh.inc:63: command not found: complete
I am not very versed into bash I think my installation might have been way to complex also (oh-my-zsh, prezto, powerlevel10k).
I just would like to know how to weed out the error and fix this.
my zshrc looks as follow
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <sorin.ionescu#gmail.com>
#
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Initialise zulu plugin manager
source "${ZULU_DIR:-"${ZDOTDIR:-$HOME}/.zulu"}/core/zulu"
zulu init
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# Customize to your needs...
autoload -Uz promptinit
promptinit
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# export PATH="$PATH:$HOME/.rvm/rubies/ruby-2.4.1/bin/"
# loading ZPLUG
export ZPLUG_HOME=/usr/local/opt/zplug
source $ZPLUG_HOME/init.zsh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:/user/path/Library/Python/3.7/bin:$PATH"
export GOOGLE_PROJECT="$(gcloud config get-value project)"
export GOOGLE_APPLICATION_CREDENTIALS="/user/path/PROJECTS/personal/k8s/gcp-k8s-credentials.json"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/user/path/google-cloud-sdk/path.zsh.inc' ]; then . '/user/path/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/user/path/google-cloud-sdk/completion.zsh.inc' ]; then . '/user/path/google-cloud-sdk/completion.zsh.inc'; fi
# iziwork key
export GITHUB_AUTH_TOKEN=xxx
EDIT
Bash Version : echo $BASH_VERSION gives a blank line.
Zsh Version : 5.7.1
prezto: old shell detected, minimum required: 4.3.17
Check your zsh version
zsh --version
In the end there were several issues, following the upgrade of brew some path did not get properly upgraded in the .zshrc file:
fpath in ~/.config/zulu was pointing to an older or incorrect version of zsh (particularly .../zsh/function)
path for zplug was incorrect
some gcloud command called before setting the path to gcloud
so
#this
/usr/local/Cellar/zsh/5.8/share/zsh/functions
#became
/usr/local/Cellar/zsh/5.8_1/share/zsh/functions
and
#this
export ZPLUG_HOME=/usr/local/Cellar/zplug/2.4.2/autoload/zplug
#became this
export ZPLUG_HOME=/usr/local/Cellar/zplug/2.4.2

Quotes became invalid in .zshrc file

In my .zshrc file, if I add
alias vii=“mvim -v”
or
alias vii=‘mvim -v’
After I used command vii, the terminal displayed:
zsh: command not found: “mvim
or
zsh: command not found: ‘mvim
If I put
alias vii=mvim -v
Then, commandvii works as mvim without -v
Same, in my .zshrc file,
ZSH_THEME=robbyrussell works.
ZSH_THEME=“robbyrussell" doesn't work
Why quotes became invalid in the .zshrc file?
How to solve?
You have to use ASCII quotes, not the curly quotes your editor is inserting.
Compare
alias vii=“mvim -v” # wrong
with
alias vii="mvim -v" # right

ZSH not recognizing my aliases?

Using iTerm2 with zsh and it isn't recognizing my aliases. Sometimes I have to work in an IDE and can't just easily vim something and the stupid people thought it a good idea to name their applications like MyReallyLongApplicationName.app and since .html files open by default in browsers, I have to:
open -a MyReallyLongApplicationName.app something.html
I have an alias in my .zshrc like:
alias ide="open -a MyReallyLongApplicationName.app"
But zsh won't recognize my aliases. I tried another one just to see if it was me but none of the aliases I create are recognized. Just get "zsh: command not found: ide" or whatever.
So I'm not sure what I'm doing wrong and I've been searching around all day trying to fix things in zsh and the like. As a note, I'm not a pro at Linux/Unix systems so if you're too technical and vague I probably won't understand what you're telling me.
Thanks!
if you do a very simple alias in zsh, does it work? open your .zshrc file, and add the following line:
alias ls='ls -GpF'
after adding that line, type this line in your Terminal:
source ~/.zshrc
tell us what happens. Also, just for shiggles, make sure you are using single quotes vs. double quotes, I have seen that make a difference in the past on different versions of shells/OS/whatnot.
Add "source ~/.bash_profile" to your ~/.zsh config file.
Put this line:
/source: 'source ~/.bash_profile' into ~/.zshrc
After saving changes in ~/.zshrc file, open a new shell window and execute the command in it.
Sometimes the simple solution is what we need...
Add "source ~/.bash_profile" to your ~/.zshrc config file
echo source ~/.bash_profile >> ~/.zshrc
I needed to manually add the alias to my zsh config file and then run the source command on it.
echo alias this='some command' >> ~/.zshrc
source ~/.zshrc
In my case issue was space b/w aliasName and equalTo. you should have to remove those space.
bad assignment
alias keu = 'k exec -it utils bash'
correct one
alias keu='k exec -it utils bash'
What I did, in this case, was created a separate file to store all my aliases. I found this way to be cleaner and easier maintained.
My aliases file is simply called aliases and within my .zshrc I have the following:
# Linking my aliases file
source ~/foldername/aliases
Make sure the double quotes are actual double quotes and not some other character which looks like double quotes.
I was editing ~/.zsh-aliases in OSX - TextEdit, which, when hitting the double quotes key substituted it for another special double quotes character, which is not what ZSH expects.
After editing the alias file with Sublime and replacing the old double quotes with actual double quotes everything runs just fine.
Hope this helps.
I had all my aliases on ~/.bash_profile, so i added at the last line on ~/.zshrc the following line: . ~/.bash_profile and it worked for me.
You should put alias at the end of ~/.zshrc file.
you can use below command to do that:
echo alias this='some command' >> ~/.zshrc
after that run
source ~/.zshrc
then, open a new terminal and execute the command in it.
I'm using both bash and zsh with one .bashrc, .bash_aliases and .zshrc file.
Put this in you .zshrc to load bash files:
# shortcut to refresh .zshrc
alias refz="source ~/.zshrc"
# Load bash files to zsh
test -f $HOME/.bashrc && . $HOME/.bashrc
test -f $HOME/.bash_aliases && . $HOME/.bash_aliases
If you have many bash aliases and functions you may will have some error messages like:
/proc/self/fd/13:12310: bad option: -t
caused by bash specific lines in.bash_aliases or .bashrc files
You can skip those problematic ones using:
if [ -n "$BASH" ] ;then
lines to ignore by zsh
fi
For example kubectl autocompletion
# To fix error massage .bashrc:16: command not found: shopt
# Check if bash is the current shell, if not, skip it
if [ -n "$BASH" ] ;then
# kubectl and bash completions
if [ -x "$(command -v kubectl)" ]; then
source <(kubectl completion bash)
complete -F __start_kubectl k
fi
if ! shopt -oq posix; then
if [ -f /etc/profile.d/bash_completion.sh ]; then
. /etc/profile.d/bash_completion.sh
fi
fi
fi
# Instead I need to put this line somewhere in my zshrc
# to have kubectl autocompletion replacing the skipped bash one:
plugins=(git git-flow brew history node npm kubectl)
# To fix error message .bash_aliases:4: parse error: condition expected: =
# Change these to this syntax to be used by zhs
# Not compatible with zsh:
if [ $HOSTNAME = "x1" ]; then
# Compatible with bash and zsh:
if [[ $HOSTNAME == "x1" ]]; then
I had a bad alias line that should have been obvious.
There is no error checking in these zsh custom scripts, so you may, like me, waste a couple of precious hours trying to find out why your custom aliases or functions are not loading in iTerm2.
I am using MacOS Ventura 13.1 and iTerm 2 v3.4, zsh 5.8.1.
I reloaded and using . ~/zshrc and followed a lot of the suggestions above.
I finally copied my list of aliases and function to the ~/.zshrc file.
Another ~/.zshrc gave me a bad pattern error.
The fix for my case was as follows.
In line with a Unicode string or something that is escaped and requires ' ' (single quotes), you must use the other quote character (double quotes) to encapsulate the alias sting.
In my case, I had entered.
alias fixitemerrow='printf '\e[?2004l''
The fix for this is:-
alias fixitemerrow=" printf '\e[?2004l' "
Do not add spaces in your alias assignment. This is here just for illustration.
Spaces would also require double encapsulation " ' ' ".
Need to create a profile for .zshrc and register the alias into it. (only if the profile isn't available)
cd ~
touch .zshrc && open .zshrc
add all the alias in .zshrc file
source ~/.zshrc
close and re-open terminal and run the alias.

Syntax error when running RVM function

First of all, I'm running bash 3.2.48 on mac osx 10.7.1 with xCode 4 installed.
I've downloaded RVM like specified in the official documentation but when I do
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
I get an error
-bash: /Users/kevin/.rvm/scripts/rvm: line 28: syntax error near unexpected token `done'
-bash: /Users/kevin/.rvm/scripts/rvm: line 28: ` done'
I've searched either on Google, the rvm github issue tracker and stackoverflow but I didn't get any info on similar issue or anything that helped me find a solution.
Nobody seems to have trouble like this installing RVM 1.8.3 so I guess something is going wrong when I install on my mac.
Here's the corresponding part of the script.
#!/usr/bin/env bash
# rvm : Ruby enVironment Manager
# https://rvm.beginrescueend.com
# https://github.com/wayneeseguin/rvm
# Is RVM loaded as a shell function already?
export HOME="${HOME%%+(\/)}" # Remove trailing slashes if they exist on HOME
if (( ${rvm_ignore_rvmrc:=0} == 0 ))
then
for rvmrc in /etc/rvmrc "$HOME/.rvmrc"
do
if [[ -f "$rvmrc" ]]
then
if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
printf "\nError:
$rvmrc is for rvm settings only.
rvm CLI may NOT be called from within $rvmrc.
Skipping the loading of $rvmrc"
return 1
else
source "$rvmrc"
fi
fi
done
fi
The error triggers on done just before the last if
Any help would be greatly appreciated.
EDIT: I found the problem, I mispelled an alias as fi. I just renamed it and it worked.
Thank you for your help. Sorry for this useless question.
I believe you're not supposed to type that but rather add it to your ~/.bash_profile at least that's how I did it on linux before, could you point where are you reading the steps for installation from?
That is correct, thats not for running at the commandline, that goes in your .bash_profile or .bashrc (with a corresponding
if [ -f "$HOME/.bashrc" ]; then
source $HOME/.bashrc
fi
in your .bash_profile)
So I decided to switch to zsh for a few reasons and it worked without doing anything but putting the line into the zshrc. But I will try to find the problem anyway.

Installing RVM (Ruby Version Manager)

Can someone please translate this into manageable steps I need to take:
~ Wayne
You must now finish the install manually:
1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
Please note that this must only occur once - so, you only need to add it the first time you install rvm.
2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly).
This means that if you see '[ -z ] && return' then you must change this line to:
if [[ ! -z ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Be absolutely *sure* to REMOVE the '&& return'.
If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile.
placing all non-interactive items in the .bashrc, including the 'source' line above
3) Then CLOSE THIS SHELL and open a new one in order to use rvm.
[ -z "$PS1" ] && return
WARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc.
This means that if you see '[ -z $PS1 ] && return' then you must change this line to:
if [[ -n $PS1 ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Even if you use zsh you should still adjust the .bashrc as above.
If you have any questions about this please visit #rvm on irc.freenode.net.
Installation of RVM to /home/kapplej/.rvm/ is complete.
I'm a complete newbie, so I am not even sure which one is shell's loading file, and how do I edit it?
I found out how to do this, hope this saves someone time:
to install RVM, enter the following in your terminal:
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
once you install rvm,
depending on which text editor you are using, I am using mate, so I typed in:
mate .bashrc
then once your text editor window opens up, copy and paste this line into it:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
now save and close that window.
then repeat for:
mate .bash_profile
close that terminal and restart a new terminal
type in:
rvm use 1.9.1 (or 1.9.2)
then type in:
ruby -v
and you should see ruby1.9.1
to get back to default, type:
rvm default
now you should get ruby 1.8.6 (or 1.8.7 depending on your default).
I was having trouble with this same step from the RVM website:
The first time you install RVM, you must put the following line into your profile at the very end, after all path loads etc: [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Finally got it working after inserting that line into the .profile file, .bash_profile, and .bashrc files in the home directory of my user on OS X.
It seems like all of these are not necessary. Since the RVM website only says "put the following line into your profile" it's sort of misleading to a noob like me that doesn't really know what my profile is.
Can someone tell me which of these files (profile file, .bash_profile, and .bashrc files) that I can remove that line from?

Resources