I am trying to make the following double do while boucle:
#!/bin/bash
#Router cisco
ls equipos/ |grep cisco |tr ' ' '\n' >> $$.cisco.tmp
config="/Users/joseluis/Desktop/prueba/config"
echo "XXXXXXXXXX ficheros"
echo $$.cisco.tmp
echo $config
echo "XXXXXXXXXX contenido tmp"
cat $$.cisco.tmp
echo "XXXXXXXXXX contenido config"
cat $config
echo "XXXXXXXXXX"
while IFS= read -r router
do
echo "LOOP"
echo $router
echo "equipos/$router"
while IFS= read -r config
do
grep "$config" "equipos/$router" &> /dev/null
if [ $? == "1" ]; then
echo "$router -> $config"
fi
echo "---"
echo "$config"
echo "---"
done <"$config"
done <"$$.cisco.tmp"
rm $$.cisco.tmp
$ ./script.sh
XXXXXXXXXX ficheros
7405.cisco.tmp
/Users/joseluis/Desktop/prueba/config
XXXXXXXXXX contenido tmp
cisco.1
cisco.2
XXXXXXXXXX contenido config
a
1
XXXXXXXXXX
LOOP
cisco.1
equipos/cisco.1
---
a
---
cisco.1 -> 1
---
1
---
LOOP
cisco.2
equipos/cisco.2
./script.sh: line 41: : No such file or directory
But when i tried to evaluate the second condition i receive the "No such file or directory" error, but that is no true, the file exists. Why i receive this error? Can somebody help me?
Thank you.
BR.