What does echo prefix = ~ / .node >> ~ / .npmrc mean?

I am reading this https://stackoverflow.com/a/3126129/212732 during yo and npm without sudo , storing their results in ~/.node .

It uses echo prefix = ~/.node >> ~/.npmrc , and I would like to know what each character means and how they work together in this case.

+6
linux unix shell
source share
1 answer
 echo prefix = ~/.node 

It just prints the string to standard output. The shell will expand ~ to the value of $HOME , so the printed line may be something like "prefix = /home/randwa1k" (without quotes, of course).

 ... >> ~/.npmrc 

This redirects the output of the echo command to the ~/.npmrc , which expands to the same value as $HOME/.npmrc . Using >> rather than > means that the output is appended to the end of the file.

Thus, the command as a whole adds one line of text to a file named .npmrc in your home directory.

The effects of this change in the .npmrc file will depend on which programs read this file.

+7
source share

All Articles