0


I'm trying this command in my prompt to get all results into one file:

$ echo $(apt-cache search nano) > search

But, they are writing in a one line:

$ 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-...

What am I doing wrong?

Alexey Berezuev
  • 785
  • 9
  • 27

1 Answers1

3

You just need to use:

apt-cache search nano > search

There is no need to use echo and command substitution which is stripping newlines to a space due to absence of quotes around your command.

anubhava
  • 761,203
  • 64
  • 569
  • 643