Echo 命令剪切新行
Echo command cuts new lines
我在提示中尝试使用此命令将所有结果放入一个文件中:
$ echo $(apt-cache search nano) > search
但是,他们写在一行中:
$ cat search
alpine-pico - Simple text editor from Alpine, a text-based email client libboost-chrono-dev - C++ representation of time duration, time point, and clocks (default version) libboost-chrono1.49-dev - C++ representation of time duration, time point, and clocks libboost-chrono1.49.0 - C++ representation of time duration, time point, and clocks science-config - Debian Science Project config package science-nanoscale-physics - Debian Science Nanoscale Physics packages science-nanoscale-physics-...
我做错了什么?
你只需要使用:
apt-cache search nano > search
不需要使用 echo
和命令替换,由于您的命令周围没有引号,因此将换行符剥离为 space。
我在提示中尝试使用此命令将所有结果放入一个文件中:
$ echo $(apt-cache search nano) > search
但是,他们写在一行中:
$ cat search
alpine-pico - Simple text editor from Alpine, a text-based email client libboost-chrono-dev - C++ representation of time duration, time point, and clocks (default version) libboost-chrono1.49-dev - C++ representation of time duration, time point, and clocks libboost-chrono1.49.0 - C++ representation of time duration, time point, and clocks science-config - Debian Science Project config package science-nanoscale-physics - Debian Science Nanoscale Physics packages science-nanoscale-physics-...
我做错了什么?
你只需要使用:
apt-cache search nano > search
不需要使用 echo
和命令替换,由于您的命令周围没有引号,因此将换行符剥离为 space。