PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, October 6, 2022

[FIXED] When I open my terminal, I receive the following message -> /Users/pankajkumar/.zshrc:[:9: ']' expected

 October 06, 2022     oh-my-zsh, terminal, zsh, zshrc     No comments   

Issue

It seems that whenever I open my terminal in Mac M1, I get this error message. I have attached a screenshot of the terminal, as well as a .zshrc file. If anyone knows the solution, please let me know.

👇 The terminal displays this information 👇

/Users/pankajkumar/.zshrc:[:9: ']' expected
pankajkumar@Pankajs-MacBook-Pro ~ %

👇 Data inside .zshrc file 👇

local brew_opt_path="/opt/homebrew/opt"
local nvm_path="$HOME/.nvm"

export PATH="${brew_path}:${PATH}"
export NVM_DIR="${nvm_path}"

[ -s "${brew_opt_path}/nvm/nvm.sh" ] && . "${brew_opt_path}/nvm/nvm.sh" #This load nvm

[ -s "${brew_opt_path}/nvm/etc/bash_completion.d/nvm"] && . "${brew_opt_path}/nvm/etc/bash_completion.d/nvm" #This loads nvm bash_completion

export PATH="/opt/homebrew/opt/php@8.0/bin:$PATH" export PATH="/opt/homebrew/opt/php@8.0/sbin:$PATH"


Solution

Spaces matter when dealing with the brackets:

[ -s "${brew_opt_path}/nvm/etc/bash_completion.d/nvm"] && . "${brew_opt_path}/nvm/etc/bash_completion.d/nvm" #This loads nvm bash_completion

This must be like so:

[ -s "${brew_opt_path}/nvm/etc/bash_completion.d/nvm" ] && . "${brew_opt_path}/nvm/etc/bash_completion.d/nvm" #This loads nvm bash_completion

Notice the space between nvm" and ].



Answered By - James Risner
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing