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*

6
  • Think I'd be asking this question if I didn't wholeheartedly believe that? :) Commented Jun 21, 2021 at 23:20
  • believe what? that it's simple to add two arrays in bash? or that you should use any language that isn't a shell? Commented Jun 21, 2021 at 23:21
  • I was referring to your last few paragraphs, pointing out that I probably shouldn't be doing this in bash. Commented Jun 21, 2021 at 23:30
  • Now to the content of your answer, I'm a little confused by the last two lines of your code sample. It appears you said to type "typeset -p a". From what I can tell, there is no "-p" option for "typeset". I would think it is "-a", not "-p". Curiously, if I change it to "-a", it makes my sample break. I'll have to update the main post with details. Commented Jun 21, 2021 at 23:32
  • 1
    @DavidM.Karr typeset is a synonym for declare. See help declare in your bash shell. -p prints the attributes of a. Commented Jun 21, 2021 at 23:44