`echo prefix =〜/.node>>是什么意思? 〜/.npmrc`是什么意思? [英] What does `echo prefix = ~/.node >> ~/.npmrc` mean?
问题描述
我正在阅读 stackoverflow答案,它们是在运行yo
和npm
而没有sudo
时运行的,方法是保存它们结果为~/.node
.
I'm reading this stackoverflow answer on running yo
and npm
without sudo
by saving their results in ~/.node
.
它使用echo prefix = ~/.node >> ~/.npmrc
,在这种情况下,我想知道每个符号的含义以及它们如何协同工作.
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
这只是将字符串打印到标准输出.外壳程序会将~
扩展为$HOME
的值,因此打印的字符串可能类似于"prefix = /home/randwa1k"
(当然不带引号).
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
这会将echo
命令的输出重定向到文件~/.npmrc
,该文件扩展为与$HOME/.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.
因此,该命令总体上将一行文本附加到主目录中名为.npmrc
的文件中.
So the command as a whole appends one line of text to a file called .npmrc
in your home directory.
对.npmrc
文件所做的更改将取决于读取该文件的程序.
The effects of that change to the .npmrc
file are going to depend on whatever programs read that file.
这篇关于`echo prefix =〜/.node>>是什么意思? 〜/.npmrc`是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!