如果您是Linux新手,那么许多命令及其变体可能看起来有点混乱。以“echo”命令为例。为什么人们在安装软件时使用它?今天的超级用户问答帖子回答了一位Linux新用户的问题。
今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。
超级用户读者PallavBakshi想知道为什么人们在Linux中安装软件时使用“echo”命令:
I am new to the computing world. While installing ROS Indigo, the first step said that I should use the following code:
Why do people use the “echo” command along with “sh -c” in this context? I have seen the “echo” command used in other installation processes as well.
Links I Looked Through
What Exactly is the “sh” Command?
Ubuntu Install of ROS Indigo
为什么人们在Linux中安装软件时使用“echo”命令?
超级用户舰队司令部给了我们答案:
Ordinarily, the function of the “echo” command is to display a string (piece of text) on the c***ole. But this time, a (greater than) > character is added after the echo command, redirecting its output to a text file located in /etc/apt/sources.list.d/ros-latest.list.
Basically, this whole command writes a piece of text to a text file. Now, here comes the tricky part:
The string written to the file may be different for each computer. The part, $(l**_release -sc), is resolved (changed into something else) when the “echo” command runs.
You can open /etc/apt/sources.list.d/ros-latest.list in a text editor before and after the command to see the changes for yourself. Keep in mind that the file might not exist before using this command.
有什么要补充的解释吗?在评论中发出声音。想从其他精通技术的Stack Exchange用户那里了解更多答案吗?在这里查看完整的讨论主题。
... 您还可以同时运行不同的发行版,为什么不全部尝试呢? ...
... 如果Lubuntu本身对你来说不够轻,为什么不试试LXLE,Lubuntu额外的寿命延长?LXLE甚至比Lubuntu更轻,非常适合在低规格但支持虚拟化的硬件上作为虚拟机运行。 ...
... 在Ubuntu或Raspbian中安装USB闪存或SD卡有问题吗?告诉我们吧。 ...
...是在Linux上使用Windows子系统,但它没有桌面环境。那么,为什么不安装自己的Linux发行版呢? ...
想在Arch Linux上安装软件包但不知道如何安装?很多人在第一次从基于Debian的发行版迁移到Arch时都面临这个问题。但是,您可以使用包管理器在基于Arch的系统上轻松地管理包。 ...
... 要在终端中安装deb文件,请打开包含deb文件的目录,然后使用以下命令激活dpkg: ...