To start with, please use ***
[code][/code] tags*** around your code and data, to preserve formatting and to improve readability. Please do
not use quote tags, bolding, colors, or other fancy formatting.
You're still trying to put a command inside a single variable. That's
not the correct way to do it.
This is the kind of thing you should set up as a function. Remember, variables (including arrays) store
data, functions store
code (i.e. commands).
First define the function, usually somewhere near the top of the script, but always before you need it.
Code:
RunAfter() {
# Simply uses curl to download and print all urls passed to it.
curl "$@"
}
Since
curl can operate on multiple urls at once, you really only need a single instance (hint, learn how to make effective use of the features of the commands you're calling).
Then at the appropriate place in the script, use it just like any other command.
Code:
RunAfter "http://myserver.tld/generate.php" "http://myserver.tld/translate.php"
http://mywiki.wooledge.org/BashGuide...ands#Functions
Although actually, the desired operation is so simple in this case why bother with a function at all?, why not just use
curl directly? functions are really there for when you need to create a
complex command block that will be used repeatedly.
BTW, if your server name is always the same, consider storing it in a separate variable too. The general principle is to avoid hard-coding of data and duplication of code wherever possible.
Code:
servername='http://myserver.tld'
curl "$servername/"{generate,translate}.php
Notice here how I concatenated the quoted variable string with the unquoted
brace expansion.