Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    You must be sure to choose a symbol that will never appear in the files. Commented Nov 8, 2014 at 12:28
  • 3
    Your loop answer is one of the ugliest I've ever seen (no offense). If you just want to put the content of a file in an array, please consider using mapfile instead; or at least, don't use eval since read (or even printf) will happily set an array field for you. Also, remove the function keyword when you're defining a function ;). Commented Nov 8, 2014 at 13:43
  • @gniourf_gniourf Many thanks for comments. I hadn't use mapfile offen so have it fully forgotten. Commented Nov 8, 2014 at 18:02
  • You very likely need the -t option to mapfile. Commented Nov 8, 2014 at 18:05
  • @gniourf_gniourf OK, tested, edited. Commented Nov 8, 2014 at 18:11