I'm relatively new to shell scripting, but have nearly completed a script which makes use of the lftp program. The part of the script I am having trouble with is when I create a long string of commands (separated by ;
).
for var in something
do
...
commands_to_run+="echo Result is `tail -n 1 $somefile`;"
done
What I'm noticing is that the tail
program - wrapped in the backticks - is being run when the for loop is iterating, but not when I invoke the string of commands later in my script.
Unfortunately, the contents of $somefile isn't at this stage ready to be inspected. How can I get the command to execute when I need it, and not while I'm creating the string?