As discussed above, replace the sprintf and the shell expansion.