我在提示符中尝试使用此命令将所有结果合并到一个文件中:
$ 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-...
我做错了什么?
答案 0 :(得分:3)
你只需要使用:
apt-cache search nano > search
由于您的命令周围没有引号,因此无需使用echo
和命令替换,即将换行符删除到空格。