LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Half command constant half reiterated? (https://www.linuxquestions.org/questions/linux-general-1/half-command-constant-half-reiterated-495977/)

PLRCA2 10-27-2006 02:21 AM

Half command constant half reiterated?
 
I'm not really sure how to ask this question in words, so I'll just give examples.

the command I want to run is:
ip route add default scope global \
nexthop via (IP address 1) weight 1 \
nexthop via (IP address 2) weight 1 \
...

I am attempting to make a script that will add the "nexthop via (IP address) weight 1" part an arbitrary number of times. Failed method so is:

ip route add default scope global \
for i in `seq 1 n`;
do
nexthop via (IP address) weight 1 \
done

The preceeding gives the error " nexthop: command not found"

Any ideas?
Thanks

PLRCA2 10-27-2006 02:55 AM

Nvm, I found a solution. Ugly, but it works. Just echo the lines into another file and then execute that file.


All times are GMT -5. The time now is 01:55 AM.