Search code examples
zshrbenv

What does this mean >> ~/.zshrc?


Can someone clarify me the difference between these two lines?

export PATH=./bin:~/.rbenv/bin:$PATH

and

export PATH=./bin:~/.rbenv/bin:$PATH >> ~/.zshrc

What is this doing?

>> ~/.zshrc

This is written in a .zshrc file. Which language is used there? Where I can learn the syntax? The export, eval etc.


Solution

  • Usually this is used outside of the .zshrc file (or .bashrc file or similar) to add something to it, for example you would normally write something like the following:

    echo 'export PATH=./bin:~/.rbenv/bin:$PATH' >> ~/.zshrc
    

    This will write the export setting within the quotes to your .zshrc file so that, assuming you are using ZSH as your shell, it will get executed when you log in.

    The fact that the line actually in your .zshrc file contains this would appear to be an error. In this case it will write the output from the export command to the .zshrc file every time you log in. The export command outputs nothing, so this extra part will essentially do nothing, and should probably be removed so you are left with just the first line.