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*

4
  • Have you consider usage of temporary file instead of array? Commented Apr 26, 2017 at 6:25
  • @Romeo ninov I have tried that way, It saying no space. test.sh[20]: no space Commented Apr 26, 2017 at 6:32
  • Place this temporary file in filesystem where you have enough diskspace Commented Apr 26, 2017 at 6:47
  • 1
    1) Please don't parse ls, that is very likely to fail. 2) It seems very, very unlikely that you actually need to have all of this stored in an array. Why don't you just iterate over the list dynamically in a loop? Why do you need to have everything saved first? Maybe if you explain what your script is trying to do we can give you a simpler approach. 3) If you find yourself setting up an array with thousands of elements, it is a sign that you should switch to a more powerful language. The shell is very limited and not a "real" scripting language. Commented Apr 26, 2017 at 8:47