The syntax for specifying a metric value with the
ip route command is fairly straightforward:
Code:
ip route add <network> via <gateway> metric <metric>
Your question is a bit vague. Are you having trouble with the command itself, or is it something to do with how the script obtains/generates/uses the metric value?