From a688de9823b880ca5a8cf68884d2df78e2d5c5e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicol=C3=A1s=20Dimov?= Date: Wed, 29 Jun 2005 11:25:17 +0000 Subject: [PATCH] el script que me paso mazzi --- enrutador | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 enrutador diff --git a/enrutador b/enrutador new file mode 100644 index 0000000..3cbac01 --- /dev/null +++ b/enrutador @@ -0,0 +1,24 @@ +#!/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 + -- 2.43.0