Suppose I have a graphical program named app
. Usage example: app -t 'first tab' -t 'second tab'
opens two 'tabs' in that program.
The question is: how can I execute the command (i.e. app
) from within a bash
script if the number of arguments can vary?
Consider this:
#!/bin/bash tabs=( 'first tab' 'second tab' ) # Open the app (starting with some tabs). app # ... How to get `app -t 'first tab' -t 'second tab'`?
I would like the above script to have an effect equivalent to app -t 'first tab' -t 'second tab'
. How can such a bash script be written?
Edit: note that the question is asking about composing command line arguments on the fly using an array of arguments.