How do I sort an array in Linux?

How do I sort an array in Linux?
Answer
  1. Copy the array to the positional arguments. …
  2. Then sort does its thing.
  3. Read the stream into an array with mapfile (e.g. mapfile -t array reads each line into the variable array and the -t ignores the n in each line).
  4. Dump the array to show its been sorted.
 

Tìm kiếm

Back
Top