I'm reading this stackoverflow answer on running yo
and npm
without sudo
by saving their results in ~/.node
.
It uses echo prefix = ~/.node >> ~/.npmrc
, and I'd like to know what each symbol means and how they work together in this case.
echo prefix = ~/.node
This simply prints a string to standard output. The shell will expand ~
to the value of $HOME
, so the string printed might be something like "prefix = /home/randwa1k"
(without the quotation marks, of course).
... >> ~/.npmrc
This redirects the output of the echo
command to the file ~/.npmrc
, which expands to the same thing as $HOME/.npmrc
. Using >>
rather than >
means that the output is appended to the end of the file.
So the command as a whole appends one line of text to a file called .npmrc
in your home directory.
The effects of that change to the .npmrc
file are going to depend on whatever programs read that file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With