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
  • This is very very very overcomplicated for shell scripting. Just use a pipeline. You should be able to stuff all of this in a single command; you don't need functions at all. Commented May 10, 2016 at 18:12
  • I cut the relevant part of the script, but I use these functions at several places in the script (I have a 5 or so if-elif-elif ... and they nearly all use these two functions. Commented May 10, 2016 at 21:40
  • Fair enough. You should still check out the Bash guide, particularly the section on case switches. Commented May 10, 2016 at 21:43
  • Also, if you're going to rely heavily on command substitution for passing text back from functions et. al., you definitely need to learn about quoting your variables. Commented May 10, 2016 at 21:44