Search code examples
bashmacoszsh

Not able to add path in zsh profile, valid directory showing not found have tried in both bash and zsh


nikitapant@IND-FVFXL93UHV29 ~ % ls
Applications        Library         Postman Agent
DataGripProjects    Movies          Public
Desktop         Music           Result_33.csv
Documents       Pictures        spark
Downloads       Postman
nikitapant@IND-FVFXL93UHV29 ~ % pwd
/Users/vaibhavkumar
nikitapant@IND-FVFXL93UHV29 ~ % echo $PATH
/Users/vaibhavkumar:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
nikitapant@IND-FVFXL93UHV29 ~ % source ~/.zshrc
/Users/vaibhavkumar/.zshrc:5: /Users/vaibhavkumar/spark not found
nikitapant@IND-FVFXL93UHV29 ~ % vi ~/.zshrc
nikitapant@IND-FVFXL93UHV29 ~ % 

As this folder is available at the specified location but showing not found, not able to find any clue.

png


Solution

  • You need to get rid of the $.

    export SPARK_HOME=/Users/vaibhavkumar/spark
    

    With the dollar sign, the undefined parameter first expands to the empty string, leaving you with

    export =/Users/vaibhavkumar/spark
    

    A word prefixed with = in zsh tries to do path lookup on that word. Since there is no file named /Users/vaibhavkumar/spark in any directory in your PATH variable, you get the observed error.