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.

3
  • Note that leaving ${job_command} unquoted involves $IFS splitting and globbing. So if relying on that brain-damaged split+glob operator to do the splitting, in the general case, you'd likely want to make sure $IFS contains the separator you want and disable globbing. Commented Nov 10, 2022 at 8:26
  • I suppect the OP intended $job_command to contain shell code and then the command would be sudo sh -c "$job_command" Commented Nov 10, 2022 at 8:34
  • @Stéphane all the intended contents are given in the question, and the sh -c approach would indeed be better (or Kusalananda’s split arguments approach). Commented Nov 10, 2022 at 8:40