#!/bin/bash # Uso: ./enrutador.sh archivo.csv exec 3<"$1" while read line do c2=`echo "$line" | cut -d, -f2` c3=`echo "$line" | cut -d, -f3` c4=`echo "$line" | cut -d, -f4` c5=`echo "$line" | cut -d, -f5` c6=`echo "$line" | cut -d, -f6` c7=`echo "$line" | cut -d, -f7` set -- $line if [ "$c6" = "*" ]; then echo route add -net "$c2 netmask $c3 dev $c4 metric $c7" route add -net "$c2" netmask "$c3" dev "$c4" metric "$c7" else echo route add -net "$c2 netmask $c3 dev $c4 gw $c6 metric $c7" route add -net "$c2" netmask "$c3" dev "$c4" gw "$c6" metric "$c7" fi done <&3