0

In my bash script, I'm trying to read through a text file, split each line up into three different strings, and then use them in a command. Here's my script so far:

while read -r line
        do
                fName=$line | cut -d';' -f1
                fAddr=$line | cut -d';' -f2
                fPort=$line | cut -d';' -f3
                echo $line | cut -d';' -f1
                echo "--------"
                echo -e "Test connect for $fName"
                echo -e "IP: $addr"
                echo -e "PORT: $port"
                echo -e "NOPROXY"
                echo "Command: nc -zv $fAddr $fPort"
                nc -zv $fAddr $fPort
        done < "$fluxFile"

What I don't get is that when I do $line | cut -d';' -f1 alone, it does show me the singular value read from my file? Am I missing something? The fName, fAddr and fPort variables aren't used anywhere else by the way. They exist only within my loop.

Grumbunks
  • 1,027
  • 1
  • 7
  • 21

0 Answers0