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*

3
  • I guess you can have a if inside the loop like this if [[ $i == ${H[-1]} ]] to determine the last element of H. Commented Dec 13, 2016 at 13:39
  • 1
    Not if they are not unique? Commented Dec 13, 2016 at 13:55
  • I suspect this is a text processing question and not a shell question ? That is, you actually want to edit a config file right ? (in that case you don't want to use a for loop...) Commented Dec 13, 2016 at 13:55